I have two transaction manager defined in two separate spring xml file, and both of them loaded into spring context
File One
<tx:annotation-driven transaction-manager="transactionManager1"/>
<bean id="transactionManager1"
class="org.springframework.jdbc.DataSourceTransactionManager">
...
</bean>
File Two
<tx:annotation-driven transaction-manager="transactionManager2"/>
<bean id="transactionManager2"
class="org.springframework.jdbc.DataSourceTransactionManager">
...
</bean>
If I didn't indicate any qualifier for the below service, which transaction manager spring are going to use.
public class TransactionalService {
@Transactional
public void setSomething(String name) { ... }
@Transactional
public void doSomething() { ... }
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…