jeudi 16 avril 2015

Spring AOP - Service methods not called when implementing spring aop

Aop configuration has been done in my project. Below configuration has been added for that purpose. The problem is when below code in not commented, methods in formService are not called. Hence i get null pointer exception. Any idea where the problem is ? I have attached the code below..


AOP configuration :



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://ift.tt/GArMu6"
xmlns:xsi="http://ift.tt/ra1lAU"
xmlns:aop="http://ift.tt/OpNdV1"
xsi:schemaLocation="http://ift.tt/GArMu6
http://ift.tt/1cMYE2s
http://ift.tt/OpNdV1
http://ift.tt/1iMF6wJ ">

<bean id="aspectClass" class="com.unknown.aspect.AspectClass"></bean>

<aop:config>
<aop:aspect id="aspectId" ref="aspectClass">
<aop:pointcut id="abcPointcut" expression="execution(* com.unknown.pat.service.impl.patServiceImpl.generatePrefixByAccountUnit(..))"/>
<aop:pointcut id="billServicePointcut" expression="execution(* com.unknown.bill.service.impl.billServiceImpl.saveAdvancePayment(..))"/>
<aop:around pointcut-ref="abcPointcut" method="getPrefixLogAround"/>
<aop:after-returning pointcut-ref="billServicePointcut" returning="result" method="sequenceUpdateAfterReturning"/>
<aop:after-throwing pointcut-ref="billServicePointcut" throwing="error" method="sequenceUpdateAfterThrowing"/>
</aop:aspect>
</aop:config>

</beans>


Application-Context-service.xml where formService bean is configured:



<bean id="formService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>
com.radaptive.rdpv.runtime.service.FormService
</value>
</property>
<property name="target">
<ref bean="formManager" />
</property>
</bean>



<bean id="formManager" parent="txProxyTemplate">
<property name="target">
<bean class="com.radaptive.rdpv.runtime.service.impl.FormServiceImpl">
<property name="services">
<ref bean="services" />
</property>
<property name="messageResource">
<ref bean="logResourceForService" />
</property>

</bean>
</property>

<property name="transactionAttributes">
<props>

<prop key="updateForm">
</prop>
</props>
</property>
</bean>

Aucun commentaire:

Enregistrer un commentaire