Announcement Announcement Module
Collapse
No announcement yet.
Spring AOP not getting invoked on Listener class Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring AOP not getting invoked on Listener class

    I am trying to log the incoming and out messages through an SMPP Channel.
    So i have a Observer attached to this SMPP Channel, all loaded as a spring bean.

    Now on the Observer/Listener class i have configured point-cut for the methods and associated an Advice.

    Whenever any incoming messages comes to the SMPP channel, the Listener class's method is invoked, but the advice does not get triggered. When i moved same advice to another point-cut one layer at the business services. i.e. once the listener receives the messages and delegates to the business service. The advice gets invoked.

    From the logs the Listener class is run by dameon thread..

    Code:
    <bean name="smppChannel" class="com.demo.smpp.SMPPChannel" init-method="init">
    	<property name="observer" ref="smppListener" />
    </bean>
    
    <bean name="smppListener" class="com.demo.smpp.SMPPListener"/>
    
    <bean name="transactionLogger" class="com.demo.advice.TransactionLogger"/>
    
    <aop:config>
         <aop:aspect ref="transactionLogger">
               <aop:pointcut id="transaction" expression="execution(* com.demo.smpp.SMPPListener.*(..))"/>
         <aop:before pointcut-ref="transaction" method="logSMPPTransaction"/>
         </aop:aspect>
    </aop:config>
    i just have a log statement in the logSMPPTransaction method in the TransactionLogger class.

    Any help on this would be appreciated..

    Thanks

  • #2
    Ignore my post. I figured out the issue, the methods i was expecting to match the point-cut expression was not part of the interface. I forced it to use the CGLIB instead of jdk proxies. It worked..

    Thanks for your time..

    Comment

    Working...
    X