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時,不能匹配實現類