I need to use a Custom AnnotationTransactionAttributeSource in order to intercept transaction attributes. Right now, I do this using the TransactionInterceptor and injecting this in TransactionAttributeSourceAdvisor .The proxies are created using DefaultAdvisorAutoProxyCreator as given below.
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>
<bean class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
<property name="transactionInterceptor" ref="txInterceptor"/>
</bean>
<bean id="txInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="txManager"/>
<property name="transactionAttributeSource">
<bean class="org.myProject.transaction.CustomAnnotationTransactionAttributeSource"/>
</property>
</bean>
Here, CustomAnnotationTransactionAttributeSource extends AnnotationTransactionAttributeSource. Is there any way I can force Tx:annotation-driven to use my CustomAnnotationTransactionAttributeSource so that I could avoid all these configurations? . I read in one of the posts that this could be done by using BeanPostProcessors but not sure how to use it for this case.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…