Announcement Announcement Module
Collapse
No announcement yet.
How do i get aop:advisor to intercept the method of inherited classes? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do i get aop:advisor to intercept the method of inherited classes?

    I have a aop advisor on class B method using pointcut encode*. Class B has a method encodeBegin. Class B inherits Class A. Class A has a method encodeEnd.

    When class B's encodeEnd method is called, the pointcut is not
    intercepted. How do I get aop to intercept methods for the parent class?

    Thanks Anant

  • #2
    What is the complete pointcut you are using?

    -Ramnivas

    Comment


    • #3
      Point Cut Used

      Thanks ramnivas
      <aop:config proxy-target-class="true">


      <aop:advisor order="0" advice-ref="ViewUIComponentInterceptor"
      pointcut="execution(* com.company.esf.uicomponents.htmlcommun.outputter. PopupLinkOutputter.encode*(..)) " />




      <aop:advisor order="0" advice-ref="ViewUIComponentInterceptor"
      pointcut="execution(* com.company.esf.uicomponents.htmlcommun.outputter. PopupWindowOutputter.encode*(..)) " />

      </aop:config >

      PopupLinkOutputter and PopupWindowOutputter both inherit Renderer. Renderer has a method called encodeChildren. PopuplinkOutputter does
      not override the method. When someone calls PopupLinkOutputter.encodeChildren, the method is not intercepted. I like to intercept it but only when
      encode children method is called on PopuplinkOutputter.

      Comment


      • #4
        Try:

        Code:
        execution(* com.company.esf.uicomponents.htmlcommun.outputter.Renderer.encode*(..)) 
        && this(com.company.esf.uicomponents.htmlcommun.outputter.PopupLinkOutputter)
        -Ramnivas

        Comment


        • #5
          Didn't work

          It did not work unfortunately.

          Comment

          Working...
          X