Hi,
I have a situation when a class can get proxies multiple times to support multiple advices and in this case advices are getting triggered multiple times. Here is an example:
here ServiceX.someMethod is proxied twice and I guess due to which the doSomething(JoinPoint) after-advice gets triggered twice.Code:<aop:config> <aop:pointcut id="serviceMethodExecution" expression="execution(* com.mycompany.service.*.*(..))" /> </aop:config> <aop:config> <aop:aspect ref="AfterAdviceBean"> <aop:after pointcut="execution(* com.mycompany.service.ServiceX.someMethod(..))" method="doSomething(org.aspectj.lang.JoinPoint)"/> </aop:aspect> </aop:config>
Is there a way to prevent this, or to make the second aop:config reuse the proxy for ServiceX that was created as part of serviceMethodExecution pointcut?
Any help will be appreciated!
Thanks.


Reply With Quote