Skip to content

Commit 578b464

Browse files
committed
Merge pull request #37501 from sreekarareddy
* pr/37501: Don't call setValidateConnectionOnBorrow on Oracle UCP datasource Closes gh-37501
2 parents 40d4c17 + 8fad594 commit 578b464

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ PoolDataSourceImpl dataSource(DataSourceProperties properties, JdbcConnectionDet
180180
throws SQLException {
181181
PoolDataSourceImpl dataSource = createDataSource(connectionDetails, PoolDataSourceImpl.class,
182182
properties.getClassLoader());
183-
dataSource.setValidateConnectionOnBorrow(true);
184183
if (StringUtils.hasText(properties.getName())) {
185184
dataSource.setConnectionPoolName(properties.getName());
186185
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ void oracleUcpIsFallback() {
152152
}
153153

154154
@Test
155-
void oracleUcpValidatesConnectionByDefault() {
155+
void oracleUcpDoesNotValidateConnectionByDefault() {
156156
assertDataSource(PoolDataSourceImpl.class,
157157
Arrays.asList("com.zaxxer.hikari", "org.apache.tomcat", "org.apache.commons.dbcp2"), (dataSource) -> {
158-
assertThat(dataSource.getValidateConnectionOnBorrow()).isTrue();
158+
assertThat(dataSource.getValidateConnectionOnBorrow()).isFalse();
159159
// Use an internal ping when using an Oracle JDBC driver
160160
assertThat(dataSource.getSQLForValidateConnection()).isNull();
161161
});

0 commit comments

Comments
 (0)