Pointcut syntax on default constructor
Hi
I need to define a pointcut on creation of object SystenmService, default constructor
How do I do it?
The purpose of this is to inject a property change listenmer on every object creation.
This attempt doesn't crash it, but doesn't give any results either. Tried all sorts of combinations. Are there any special issues when one are setting a pointcut on a constructor? The "retVal" is not nul, but I'm not sure the method is ever called either, because I get no "Hoho" from the console.
Code:
@Aspect
public class InjectPropertyChangeListenerAdvice {
InjectPropertyChangeListenerAdvice() {
super();
System.out.println("I am!");
}
// @After("execution(public se.ki.biobank.doris.domain.systemservice.SystemService.new())")
@AfterReturning(
pointcut="execution(public se.ki.biobank.doris.domain.systemservice.SystemService.new())",
returning="retVal")
public void injectPropertyChangeListener(Object retVal) throws Throwable {
Assert.notNull(retVal, "Is null");
System.out.println("Hoho!");
((SystemService)retVal).setCaption("Urban den Glade!");
}
}
Stuck, help appreciated!
Sincerely,
/The Cantor
"Murphy was an optimist"
(The O'Toole commentary on Murphy's Law)