Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] aspect not working for classes in different package

Hello everyone,

I am an aspectj newbie trying to learn the basics. Thanks in advance for you help.

I defined an advice to print out name of methods before they are executed, the methods are defined in a class in a different package than where the aspect is. The problem is the advice does not print as I think it should. However the advice works on classes in the same package.

Here is the code:

package com.foo.a;

import com.foo.b.Test;

public aspect TracingTest {
	pointcut myclass(): within(Test);
	pointcut methods(): myclass() && execution(* *(..));
	
	before(): methods() {
		System.out.println(thisJoinPoint.getSignature().getName() + "");
	}
	
}


Thanks a lot!




Back to the top