Spring自定义注解+Aop记录用户操作日志

https://blog.****.net/persistencegoing/article/details/84376427

要点:

自定义运行时(RetentionPolicy.RUNTIME)注解
以自定义的注解作为切入点(Pointcut),与功能代码解耦
springmvc配置文件中添加配置,使SpringAop可拦截Controller层的方法。 

Spring自定义注解+Aop记录用户操作日志

下面贴代码:

自定义注解类: 

Spring自定义注解+Aop记录用户操作日志

切面类: 
 
Spring自定义注解+Aop记录用户操作日志

Spring自定义注解+Aop记录用户操作日志

Spring自定义注解+Aop记录用户操作日志

测试方法: 

Spring自定义注解+Aop记录用户操作日志
测试结果: 

Spring自定义注解+Aop记录用户操作日志

希望大家关注我一波,防止以后迷路,有需要的可以加群讨论互相学习java ,学习路线探讨,经验分享与java求职     

群号:721 515 304