Spring Boot 自定义注解

编程知识 更新时间:2023-04-05 04:19:33

前情回顾:
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 自定义注解

本文发布于:2023-04-05 04:19:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/d0bf411c6c2fa1218ed794162c06e21f.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   注解   Spring   Boot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 44735文章数
  • 14阅读数
  • 0评论数