I have two classes
public class ParentTestClass {
public void publicMethodOfParent() {
}
}
@Component
@MyAnnotation
public class ChildTestClass extends ParentTestClass {
public void publicMethodOfChild() {
}
}
With Spring AOP I need to wrap:
- all calls for all public methods that are annotated with
@MyAnnotation
if annotation is put on class level - all methods that are annotated with
@MyAnnotation
if annotation is on the method level.
Here is my pointcut
@Around("(@within(MyAnnotation) && execution(public * *(..))) || @annotation(MyAnnotation)")
public Object myWrapper(ProceedingJoinPoint invocation) throws Throwable {
// ...
}
This works for public methods of ChildTestClass
but ParentTestClass#publicMethodOfParent
is not wrapped when I make a call childTestClass.publicMethodOfParent()
How can I include parent methods?