Skip to content

Commit

Permalink
Fix property name for spring.dao.exceptiontranslation.enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
izeye authored and snicoll committed Jan 18, 2021
1 parent 52ca841 commit 21db142
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -64,7 +64,7 @@ DataSourceTransactionManager transactionManager(Environment environment, DataSou
}

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);
}

Expand Down
Expand Up @@ -87,15 +87,15 @@ void transactionManagerWithExistingTransactionManagerIsNotOverridden() {
@Test // gh-24321
void transactionManagerWithDaoExceptionTranslationDisabled() {
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))
.isExactlyInstanceOf(DataSourceTransactionManager.class));
}

@Test // gh-24321
void transactionManagerWithDaoExceptionTranslationEnabled() {
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))
.isExactlyInstanceOf(JdbcTransactionManager.class));
}
Expand Down

0 comments on commit 21db142

Please sign in to comment.