其他分享
首页 > 其他分享> > 一个Hello引发的Spring AOP 实战用法解析

一个Hello引发的Spring AOP 实战用法解析

作者:互联网

实战用法:

package com.xxx.xxx.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/api/open")
public class OpenController {
   
    @RequestMapping(value = "/hello", method = { RequestMethod.GET })
    public JsonResult hello() {
        return new JsonResult("welcome to HOME");
    }

}

package com.xxx.xxx.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.an

标签:xxx,Spring,AOP,springframework,annotation,org,import,Hello,aspectj
来源: https://blog.csdn.net/qq_38634142/article/details/121949075