前情回顾:
Spring MVC AOP通过注解方式拦截Controller等实现日志管理

1、添加spring boot引用

 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>

2、在spring boot的Application启动类中使用@EnableAspectJAutoProxy注解,添加对Aspectj支持
3、与前情回顾编写类似的OperationLogger、SysLogAspect
4、在需要使用的方法上添加 @OperationLogger注解,搞定

个人微信公众号:

作者:jiankunking 出处:http://blog.csdn/jiankunking

更多推荐

Spring Boot 自定义注解