Merge branch '2.4.x'

Closes gh-24871
pull/24946/head
Stephane Nicoll 4 years ago
commit 7592c98d5c

@ -64,7 +64,7 @@ public class DataSourceTransactionManagerAutoConfiguration {
} }
private DataSourceTransactionManager createTransactionManager(Environment environment, DataSource dataSource) { private DataSourceTransactionManager createTransactionManager(Environment environment, DataSource dataSource) {
return environment.getProperty("spring.dao.exceptiontranslation.enable", Boolean.class, Boolean.TRUE) return environment.getProperty("spring.dao.exceptiontranslation.enabled", Boolean.class, Boolean.TRUE)
? new JdbcTransactionManager(dataSource) : new DataSourceTransactionManager(dataSource); ? new JdbcTransactionManager(dataSource) : new DataSourceTransactionManager(dataSource);
} }

@ -87,7 +87,7 @@ class DataSourceTransactionManagerAutoConfigurationTests {
@Test // gh-24321 @Test // gh-24321
void transactionManagerWithDaoExceptionTranslationDisabled() { void transactionManagerWithDaoExceptionTranslationDisabled() {
this.contextRunner.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class)) this.contextRunner.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class))
.withPropertyValues("spring.dao.exceptiontranslation.enable=false") .withPropertyValues("spring.dao.exceptiontranslation.enabled=false")
.run((context) -> assertThat(context.getBean(TransactionManager.class)) .run((context) -> assertThat(context.getBean(TransactionManager.class))
.isExactlyInstanceOf(DataSourceTransactionManager.class)); .isExactlyInstanceOf(DataSourceTransactionManager.class));
} }
@ -95,7 +95,7 @@ class DataSourceTransactionManagerAutoConfigurationTests {
@Test // gh-24321 @Test // gh-24321
void transactionManagerWithDaoExceptionTranslationEnabled() { void transactionManagerWithDaoExceptionTranslationEnabled() {
this.contextRunner.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class)) this.contextRunner.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class))
.withPropertyValues("spring.dao.exceptiontranslation.enable=true") .withPropertyValues("spring.dao.exceptiontranslation.enabled=true")
.run((context) -> assertThat(context.getBean(TransactionManager.class)) .run((context) -> assertThat(context.getBean(TransactionManager.class))
.isExactlyInstanceOf(JdbcTransactionManager.class)); .isExactlyInstanceOf(JdbcTransactionManager.class));
} }

Loading…
Cancel
Save