From 21db14227c5d0146e43f1881e2a5c018f2255202 Mon Sep 17 00:00:00 2001 From: izeye Date: Mon, 18 Jan 2021 19:58:06 +0900 Subject: [PATCH] Fix property name for spring.dao.exceptiontranslation.enabled See gh-24867 --- .../jdbc/DataSourceTransactionManagerAutoConfiguration.java | 2 +- .../DataSourceTransactionManagerAutoConfigurationTests.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java index 2a491f6fb715..4fa98b3b7bd0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java @@ -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); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java index 9bb993fede20..9d9d42e25fdb 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfigurationTests.java @@ -87,7 +87,7 @@ 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)); } @@ -95,7 +95,7 @@ void transactionManagerWithDaoExceptionTranslationDisabled() { @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)); }