我在应用程序中有这个确切的需求。我找到了这个答案,但不满意无法完成。
经过更多搜索之后,我发现了用于AspectJ / Spring切入点表达式的备忘单。备忘单中的解决方案无法完全如广告中所述那样工作,但是我能够使其满足我的需要。
@Pointcut("within(@(@Annotation *) *)")public void classAnnotatedWithNestedAnnotationOneLevelDeep() { }我将此表达式与一个@within表达式组合在一起,@Annotation以获得想要的工作。
对于方法执行:
@Pointcut("execution(@(@com.someorg.SomeAnnotation *) * *(..))")public void methodAnnotatedWithNestedAnnotationOneLevelDeep() { }我将此表达式与@annotation仅用于的表达式相结合,@Annotation以获得我想为方法工作的东西。



