June 2018
Intermediate to advanced
408 pages
11h 23m
English
Declarative transactions are highly recommended because they keep transaction management out of business logic and are easy to configure. Let's see an example of annotation-based declarative transaction management.
Let's use the same example that was used in the Spring JDBC section. In our example, we are using JdbcTemplate for database interaction. So, we need to add DataSourceTransactionManager in our Spring configuration file.
The following is the Spring bean configuration class:
@Configuration@EnableTransactionManagementpublic class AppConfig { @Bean public DataSource dataSource() { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("org.postgresql.Driver"); ...Read now
Unlock full access