Hi,
Maybe I need to see a more complete codebase, but on first look, the
weaveinfo says:
> [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)
which tells me Stuff.Timer.start() is advised. Then your code to
exercise it is:
> ? ? ? ? ?com.mystuff.common.util.Stuff stuff = new Stuff();
> ? ? ? ? ?stuff.doSomething();
I didn't see a weave info saying doSomething() was advised? Does
doSomething call Stuff.Timer.start()?
Perhaps not an issue, but I might have expected double dots in these
include lines to ensure subpackages are included:
> ? ? <include within="com.mystuff.common.util.*"/>
> ? ? <include within="org.springbyexample.aspectjLoadTimeWeaving.*" />
If you want to send me a more complete program, I'll tell you whats up
with it - just email
it to me.
cheers
Andy
On 25 July 2011 23:38, Anthony Tang <
aant00@xxxxxxxxx> wrote:
> 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
> _______________________________________________
> aspectj-users mailing list
>
aspectj-users@xxxxxxxxxxx>
https://dev.eclipse.org/mailman/listinfo/aspectj-users>
>
------------------------------
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxxhttps://dev.eclipse.org/mailman/listinfo/aspectj-usersEnd of aspectj-users Digest, Vol 77, Issue
17
*********************************************