I have an Aspect class, which defines one point-cut expression as below
@Pointcut("execution(* com.vg.pw.tasks.shared.*.executeTasks(..))")
public void myTraceCall() {}
where the executeTasks() method is static. If the method is made to non-static, the method body is executed on every call of executeTasks()
. Why is my pointcut not effective on static methods?
I'm using LTW and not spring.
I just tried out your pointcut expression and it works on both static and non-static methods just as it should. I used AspectJ weaver 1.8.7. Try adding -showWeaveInfo
and -verbose
to your aop.xml for debug info on LTW.
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
<weaver options="-showWeaveInfo -verbose">
<include within="q35218146..*" />
</weaver>
<aspects>
<aspect name="q35218146.Aspect35218146"/>
</aspects>
</aspectj>
It should give you output on stderr similar to this:
[AppClassLoader@14dad5dc] weaveinfo Join point 'method-execution(void q35218146.
Test35218146.executeTasks())' in Type 'q35218146.Test35218146' (Test35218146.java:6)
advised by before advice from 'q35218146.Aspect35218146' (Aspect35218146.java)