Spring aop multiple pointcuts & advice but only the last one is working
Posted
by Jarle Hansen
on Stack Overflow
See other posts from Stack Overflow
or by Jarle Hansen
Published on 2010-05-04T07:50:41Z
Indexed on
2010/05/04
7:58 UTC
Read the original article
Hit count: 279
I have created two Spring AOP pointcuts that are completely separate and will be woven in for different parts of the system. The pointcuts are used in two different around advices, these around-advices will point to the same Java method. How the xml-file looks:
<aop:config>
<aop:pointcut expression="execution(......)" id="pointcutOne" />
<aop:pointcut expression="execution(.....)" id="pointcurTwo" />
<aop:aspect id="..." ref="springBean">
<aop:around pointcut-ref="pointcutOne" method="commonMethod" />
<aop:aroung pointcut-ref="pointcutTwo" method="commonMethod" />
</aop:aspect>
</aop:config>
The problem is that only the last pointcut works (if I change the order "pointcutOne" works because it is last). I have gotten it to work by creating one big pointcut, but I would like to have them separate. Any suggestions to why only one of the pointcuts works at a time?
© Stack Overflow or respective owner