Spring, JavaConfig (@Configuration), and TransactionManager

This extedns configuring JDBC and JPA to configure the TransactionManager.

Example #1 Wiring JDBC Transaction Manager

Note: @EnableTransactionManagement annotation

If you want to create a mock transaction manager, then you can do

Also, the unit test classes need to extend the “AbstractTransactionalJUnit4SpringContextTests”

Example #2 Wiring JPA Transaction Manager


Java Interview FAQs

800+ Java Interview Q&As

Top