I've ran into a weird problem that I've narrowed down to:
- If the execution() pointcut contains a method and that method takes no parameters, the aspect works;
- If the execution() pointcut contains a method and that method takes 1 or more paramenters, the aspect doesn't work.
To make things clear, I have this class (SessionManager) that implements ISessionManager interface that has standard getters and setters (getters return something and take no parameters, setters return void and take 1 parameter):
This doesn't work...
<aop:aspect id="aspectOne" ref="echoClient">
<aop:pointcut id="pcOne" expression="execution(* *..ISessionManager.get*(..))" />
<aop:before method="printHello" pointcut-ref="pcOne" />
I've tried it in some other methods and the behaviour is exactly the same: if the method takes arguments, the aspect fails; if the method has no arguments, then the aspect works like a charm.
<aop:aspect id="aspectTwo" ref="echoClient">
<aop:pointcut id="pcTwo" expression="execution(* *..ISessionManager.set*(..))" />
<aop:before method="printHello" pointcut-ref="pcTwo" />
I'm sure I must be doing something wrong here, but since I'm kinda new to AOP and Spring, can anyone give me a hint?
PS: ISessionManager was an interface extracted from SessionManager class, so I'm sure I'm not missing any methods on the interface.
PS2: My IDE (IntelliJ Idea) can figure out correctly what methods are to be advised in both cases but when I run the app, only the first aspect works :|