October 2017
Intermediate to advanced
396 pages
10h 2m
English
Create the bean for the required implementation just like any other Spring bean. You can configure, as appropriate, the transaction manager for any persistence technologies such as JDBC, JMS, JTA, Hibernate, JPA, and so on. But in the following example, here is the manager for a DataSource using JDBC:
In Java configuration, let's see how to define the transactionManager bean in the application:
@Bean
public PlatformTransactionManager transactionManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
In XML configuration, the bean can be created like this:
<bean id="transactionManager" class="org.springframework.jdbc.datasource. DataSourceTransactionManager"> ...
Read now
Unlock full access