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.
<aop:pointcut id="serviceMethodExecution" expression="execution(* com.mycompany.service.*.*(..))" />
<aop:after pointcut="execution(* com.mycompany.service.ServiceX.someMethod(..))" method="doSomething(org.aspectj.lang.JoinPoint)"/>
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!