Announcement Announcement Module
Collapse
No announcement yet.
How to include interceptors within transaction boundaries Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to include interceptors within transaction boundaries

    Code:
    <bean id="endpointMapping" abstract="true">
    		<property name="interceptors">
    			<list>
    				<ref bean="loggingInterceptor" />
    				<ref bean="headerInterceptor" />
    				<ref bean="validatingInterceptor" />
    			</list>
    		</property>
    	</bean>
    
    <bean parent="endpointMapping" class="com.xxxx.spring.ProxySimpleMethodEndpointMapping">
    		<property name="endpoints">
    			<list>
    				<ref local="accountValidationEndpoint" />
    			</list>
    		</property>
    	</bean>
    
    <bean id="accountValidationEndpoint"
    class="com.account.validation.service.endpoint.spring.AccountValidationServiceEndpointImpl">
    		<property name="service" ref="accountValidationService" />
    </bean>
    
    <aop:pointcut id="transactionPointcut"  expression="bean(*Endpoint)" />
    		<aop:advisor advice-ref="transactionAdvice" pointcut-ref="transactionPointcut" />
    
    
    <tx:advice id="transactionAdvice" transaction-manager="transactionManager">
    		<tx:attributes>
    			<tx:method name="*" isolation="READ_COMMITTED" />
    			<tx:method name="retrieve*" read-only="true" propagation="REQUIRED" />
    			<tx:method name="list*" read-only="true" propagation="REQUIRED" />
    		</tx:attributes>
    	</tx:advice>
    
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    		<property name="dataSource" ref="dataSource" />
    	</bean>
    Right now if something goes wrong in the interceptors roll back wont happen.
    I want the transaction to cover loggingInterceptor, headerInterceptor, validatingInterceptor also.

    Any thoughts..
Working...
X