spring default transaction manager
There are no answers and no documentation. .
<tx:annotation-driven transaction-manager="transactionManager2"/>
<tx:annotation-driven transaction-manager="transactionManager"/>
Thing Code Testing and Code Debugging Discovery
Only the first configuration works
Code debugging:
spring-tx-3.2.1.RELEASE.jar
package org.springframework.transaction.config
AnnotationDrivenBeanDefinitionParser
Entry: 77 lines of parse method
The breakpoint will debug and enter twice,
The first element is transactionManager2
Then AopAutoProxyConfigurer.configureAutoProxyCreator(element, parserContext) will be called;
!parserContext.getRegistry().containsBeanDefinition(txAdvisorBeanName) 为true
Call registerTransactionManager(element, interceptorDef); register as transactionManager2
The second element is transactionManager, but !parserContext.getRegistry().containsBeanDefinition(txAdvisorBeanName) is false
Jump out of the if block directly
Summary: Configure multiple tx:annotation-driven, only the first one is valid