Skip to content

Commit

Permalink
Merge pull request #24867 from izeye
Browse files Browse the repository at this point in the history
* pr/24867:
  Fix property name for spring.dao.exceptiontranslation.enabled

Closes gh-24867
  • Loading branch information
snicoll committed Jan 18, 2021
2 parents 52ca841 + 21db142 commit 8198098
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 8198098

Please sign in to comment.