首页 > 编程语言 > 详细

使用注解匹配Spring Aop切点表达式

时间:2016-12-02 21:31:28      阅读:560      评论:0      收藏:0      [点我收藏+]

Spring中的类基本都会标注解,所以使用注解匹配切点可以满足绝大部分需求

主要使用@within()/@target @annotaton() @args()等...

 

匹配@Service类中的所有方法:

@within(org.springframework.stereotype.Service)

 或

@target(org.springframework.stereotype.Service)

 

匹配标注了@RequestMapping的所有方法

@annotation(org.springframework.web.bind.annotation.RequestMapping)

 

匹配参数中有@RequestBody的所有方法

@args(org.springframework.web.bind.annotation.RequestBody)

 

 

 

注:有关注解的AspectJ指示器只作用于目标Class,即当这类指示器指向interface时,不能匹配实现类

使用注解匹配Spring Aop切点表达式

原文:http://www.cnblogs.com/niceboat/p/6126558.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!