Spring Boot 自定义注解

来源:互联网 发布:录像监控软件 编辑:程序博客网 时间:2024/06/11 15:59

前情回顾:
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.net/jiankunking