spring配置多个事务管理器
<tx:annotation-driven/> <bean id="transactionManager1" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="datasource1"></property> <qualifier value="datasource1Tx"/> </bean> <bean id="transactionManager2" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="datasource2"></property> <qualifier value="datasource2Tx"/> </bean>
@Transactional("transactionManager1")
@Transactional("transactionManager2")
欢迎关注我的公众号:“从零开始的it转行生”
![](https://upload-images.jianshu.io/upload_images/22777058-d0ccf15d56f2b6c7.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)