diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration.java index 6389876a24..dc6ec5d11b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration.java @@ -180,7 +180,6 @@ abstract class DataSourceConfiguration { throws SQLException { PoolDataSourceImpl dataSource = createDataSource(connectionDetails, PoolDataSourceImpl.class, properties.getClassLoader()); - dataSource.setValidateConnectionOnBorrow(true); if (StringUtils.hasText(properties.getName())) { dataSource.setConnectionPoolName(properties.getName()); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java index 75cf075367..1e2cbca310 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java @@ -152,10 +152,10 @@ class DataSourceAutoConfigurationTests { } @Test - void oracleUcpValidatesConnectionByDefault() { + void oracleUcpDoesNotValidateConnectionByDefault() { assertDataSource(PoolDataSourceImpl.class, Arrays.asList("com.zaxxer.hikari", "org.apache.tomcat", "org.apache.commons.dbcp2"), (dataSource) -> { - assertThat(dataSource.getValidateConnectionOnBorrow()).isTrue(); + assertThat(dataSource.getValidateConnectionOnBorrow()).isFalse(); // Use an internal ping when using an Oracle JDBC driver assertThat(dataSource.getSQLForValidateConnection()).isNull(); });