AspectJ LTW in eclipse - Pointcut does not work with static method

后端 未结 1 935
再見小時候
再見小時候 2020-12-22 08:48

I have an Aspect class, which defines one point-cut expression as below

@Pointcut(\"execution(* com.vg.pw.tasks.shared.*.executeTasks(..))\")
public void myT         


        
相关标签:
1条回答
  • 2020-12-22 09:12

    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)
    
    0 讨论(0)
提交回复
热议问题