0 背景介绍
工程里面使用了2个数据源,开了2个事务模版。
1 保错信息
org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type ‘org.springframework.transaction.support.TransactionTemplate’ available: expected single matching bean but found 2: secondTransactionTemplate ,thereTransactionTemplate
2 解法
@Autowired
private TransactionTemplate secondTransactionTemplate;
@Resource(name = "thereTransactionTemplate")
private TransactionTemplate thereTransactionTemplate;
使用@Resource 来指定。