@Pointcut的表达式-@annotation

可以参考@Transtactional的具体实现。

限制连接点的匹配,其中连接点的主题(在 Spring AOP 中执行的方法)具有给定的 annotation。

官方案例:

任何连接点(仅在 Spring AOP 中执行方法),其中执行方法具有@Transactional annotation:

@annotation(org.springframework.transaction.annotation.Transactional)

官方的案例已经说的很清楚了,就是@annotation是匹配拥有指定注解的方法的。这里要注意,@annotation只匹配实现类中的有注解的方法,不会匹配接口中的注解方法。

参考:

https://www.cnblogs.com/jiafa/p/13835951.html

posted @ 2021-06-08 13:37  曾鸿发  阅读(1233)  评论(0编辑  收藏  举报