ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Subject:   Injecting both Transactions & MethodAdvices
Date:   2007-01-04 15:12:52
From:   kcav8or
Response to: Injecting both Transactions & MethodAdvices

I answered my own question after a search of the Spring Support Forums. I added the LoggingThrowsAdvice as a preInterceptor on the TransactionProxyFactoryBean as follows:



<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory"> <ref local="sessionFactory" /> </property>
</bean>


<bean id="loggingThrowsAdvice" class="com.myapp.aop.LoggingThrowsAdvice">
</bean>


<bean id="txProxyTemplate" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
<property name="preInterceptors">
<list>
<ref local="loggingThrowsAdvice" />
</list>
</property>
</bean>