| Article: |
An Introduction to Aspect-Oriented Programming with the Spring Framework, Part 1 | |
| Subject: | Injecting both Transactions & MethodAdvices | |
| Date: | 2005-08-08 18:11:37 | |
| From: | EtiKatta | |
|
Response to: The diagrams are wrong?
|
||
|
Hi, Great work by you people. I have a simple question.
|
||
Showing messages 1 through 3 of 3.
-
Injecting both Transactions & MethodAdvices
2007-01-04 14:46:19 kcav8or [View]
Did you ever find a solution to this? I have the same requirement. -
Injecting both Transactions & MethodAdvices
2007-01-04 15:19:46 kcav8or [View]
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>
-
Injecting both Transactions & MethodAdvices
2007-01-04 15:12:52 kcav8or [View]
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>


