我有以下课程
class A {
public void someone() {
helpMe();
}
private void helpMe() {
// do something here
}
}
class B extends A {
public void help() {
super.someone();
}
}
class C extends A {
public void me() {
super.someone();
}
}
因此,我想每次调用helpMe
方法时都要做一些事情。从未显式调用A.helpMe()
。对A.helpMe()
的所有方法调用都是通过A.someone()
进行的,然后进一步通过B.help()
或C.me()
进行调用。
helpMe
包含其他所有类都需要的通用实现。
我尝试过的切入点
execution(* A.helpMe(..)) // does not work
execution(* A+.helpMe(..)) // does not work
execution(* *.helpMe(..)) // does not work
execution(* A.*(..)) // does not work
execution(* B.someone(..)) // does not work
execution(* A+.*(..)) // forms a point cut for B.help() and C.me() only
execution(* *.*(..)) // forms a point cut for B.help() and C.me() only
execution(* B.*(..)) // forms a point cut for B.help() only
我读到某处禁止pointcuts
使用super
。如果是这样,有效的解决方法是什么?
我尝试将pointcut
与annotations
一起使用,但这也不起作用。