Spring自定义注解+Aop记录用户操作日志
https://blog.****.net/persistencegoing/article/details/84376427
要点:
自定义运行时(RetentionPolicy.RUNTIME)注解
以自定义的注解作为切入点(Pointcut),与功能代码解耦
springmvc配置文件中添加配置,使SpringAop可拦截Controller层的方法。
下面贴代码:
自定义注解类:
切面类:
测试方法:
测试结果:
希望大家关注我一波,防止以后迷路,有需要的可以加群讨论互相学习java ,学习路线探讨,经验分享与java求职
群号:721 515 304