In the application context declare the following:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<tx:annotation-driven transaction-manager="txManager" /> <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <tx:annotation-driven transaction-manager="txManagerDiscussion" /> <bean id="txManagerDiscussion" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSourceDiscussion" /> <qualifier value="discussionTxManager"/> </bean> |
In the Java code do the following as shown below as code snippet:-
1 2 3 |
@Transactional("discussionTxManager") public void someMethod(..) {..} |
Page Visitors: 4544
The following two tabs change content below.

Tomcy John
Blogger & Author at javacodebook
He is an Enterprise Java Specialist holding a degree in Engineering (B-Tech) with over 10 years of experience in several industries. He's currently working as Principal Architect at Emirates Group IT since 2005. Prior to this he has worked with Oracle Corporation and Ernst & Young. His main specialization is on various web technologies and acts as chief mentor and Architect to facilitate incorporating Spring as Corporate Standard in the organization.

Latest posts by Tomcy John (see all)
- A Guide to Continuous Improvement for Architects - February 2, 2023
- Cloud-first Architecture Strategy - January 26, 2023
- Architecture Strategy and how to create One - January 24, 2023
I believe that tx:annotation-driven is to be defined only once.
It’s transaction-manager attribute is used to give the default value to be used for cases, where @Transactional does not specify the Transaction Manager explicitly. Therefore specifying that twice is pointless.