Hi -
I have the following advice:
@Pointcut("execution(public * com.mystuff.common.util..*.*(..))")
public void aspectjLoadTimeWeavingExamples() {
}
@Around("aspectjLoadTimeWeavingExamples()")
public Object myadvice(ProceedingJoinPoint pjp) throws Throwable {
final
Logger logger = LoggerFactory.getLogger(pjp.getSignature().getDeclaringType());
logger.debug(pjp.getSignature().getName() + ": In advice");
...
}
com.mystuff.common.util..*.* is defined in another jar in the classpath. aop.xml is as follows:
<aspectj> <aspects> <aspect name="org.springbyexample.aspectjLoadTimeWeaving.PerformanceAdvice"/>
</aspects>
<weaver
options="-verbose -showWeaveInfo">
<!-- other developers specify here their classes they wish to weave -->
<include within="com.mystuff.common.util.*"/>
<include within="org.springbyexample.aspectjLoadTimeWeaving.*" />
</weaver>
</aspectj>
The main code runs:
com.mystuff.common.util.Stuff stuff = new Stuff();
stuff.doSomething();
I see the following weave info output:
[AppClassLoader@64601bb1] weaveinfo Join point 'method-execution(void com.mystuff.common.util.Stuff.Timer.start())' in Type 'com.mystuff.common.util.Stuff' (Stuff.java:25) advised by around advice from 'org.springbyexample.aspectjLoadTimeWeaving.PerformanceAdvice' (PerformanceAdvice.java)
But the advice method (myadvice) is never executed. If I replace the pointcut _expression_ with:
@Pointcut("execution(public *
org.springbyexample.aspectjLoadTimeWeaving...*.*(..))")
I again get a similar message as above:
[AppClassLoader@64601bb1] weaveinfo Join point 'method-execution(void org.springbyexample.aspectjLoadTimeWeaving.AnotherThing.doSomething())' in Type 'org.springbyexample.aspectjLoadTimeWeaving.AnotherThing' (AnotherThing.java:10) advised by around advice from 'org.springbyexample.aspectjLoadTimeWeaving.PerformanceAdvice' (PerformanceAdvice.java)
but the advice runs as expected when calling the matching
method.
Any idea what's wrong? I'm using aspectj 1.6.9, and the following startup parameter:
-javaagent:/home/myhome/tools/aspectj/lib/aspectjweaver.jar.
Thanks for any help.
- Anthony