@AspectJ pointcut for subclasses of a class with an annotation
问题 I'm looking for a pointcut that matches method executions in classes that subclass a class with a specific annotation. The excellent AspectJ cheat sheet helped me to create the following pointcut: within(@my.own.annotations.AnnotationToMatch *) && execution(* *(..)) This matches all method calls of a class A that carries the @AnnotationToMatch, but not method of a class B that extends A. How can I match both? 回答1: public aspect AnnotatedParentPointcutAspect { //introducing empty marker