当被同一类的方法调用时,java Spring方面不工作
我定义了一个方面(在spring项目中),该方面应该在方法执行后调用
class Crap {
public void blah(){
//Do Something here
}
public void blah_internal(){
blah();
//Do Something else here
}
}
class MyAspect {
@After("execution(* Crap.blah(..))")
public void doSomething(JoinPoint joinPoint) {
System.out.println("Coming into the aspect");
//Some logic here
}
}
现在如果我说废话。平淡的方法,然后方面的工作
new Crap().blah(); //Prints "Coming into the aspect"
但是如果我用另一个方法调用这个方法,它就不起作用了
new Crap().blah_internal(); //Prints nothing
这里出了什么问题
# 1 楼答案
将切入点定义与其他asterix一起使用