Announcement Announcement Module
Collapse
No announcement yet.
Advice not executed when method is invoked within same interface Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Advice not executed when method is invoked within same interface

    I have implemented an aspect that advices a an interface implementation method. Method is adviced as expected when it it is invoked from another service but it is not when it is directly called from another method declared in the same interface.

    Aspect is declared with the following advice rule:

    @Around("execution(* package.interface.method(..)) && args(parameter,..)")

    If I invoke interface.method from another interface, the advice is executed. If I invoke interface.method from interface.method2, then it is not.

    I've tried enabling CGLIB2 proxys getting the same behaviour.

    Is anything wrong with the pointcut expressiong I've declared?

  • #2
    I have implemented an aspect that advices a an interface implementation method. Method is adviced as expected when it it is invoked from another service but it is not when it is directly called from another method declared in the same interface.
    Which is as expected. Spring uses proxies so only method calls into the object can be intercepted. If you want more use loadtime or compile time weaving.

    Comment


    • #3
      Thank you very much. It was obvious...

      Comment

      Working...
      X