Search in sources :

Example 1 with JdbcTransactionManager

use of org.springframework.jdbc.support.JdbcTransactionManager in project spring-boot by spring-projects.

the class DataSourceTransactionManagerAutoConfigurationTests method transactionManagerWithCustomizationIsConfigured.

@Test
void transactionManagerWithCustomizationIsConfigured() {
    this.contextRunner.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class)).withPropertyValues("spring.transaction.default-timeout=1m", "spring.transaction.rollback-on-commit-failure=true").run((context) -> {
        assertThat(context).hasSingleBean(TransactionManager.class).hasSingleBean(JdbcTransactionManager.class);
        JdbcTransactionManager transactionManager = context.getBean(JdbcTransactionManager.class);
        assertThat(transactionManager.getDefaultTimeout()).isEqualTo(60);
        assertThat(transactionManager.isRollbackOnCommitFailure()).isTrue();
    });
}
Also used : JdbcTransactionManager(org.springframework.jdbc.support.JdbcTransactionManager) TransactionManager(org.springframework.transaction.TransactionManager) JdbcTransactionManager(org.springframework.jdbc.support.JdbcTransactionManager) DataSourceTransactionManager(org.springframework.jdbc.datasource.DataSourceTransactionManager) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 DataSourceTransactionManager (org.springframework.jdbc.datasource.DataSourceTransactionManager)1 JdbcTransactionManager (org.springframework.jdbc.support.JdbcTransactionManager)1 TransactionManager (org.springframework.transaction.TransactionManager)1