Skip to content

Commit 6bd042e

Browse files
committed
Upgrade to Commons DBCP2 2.11.0
Closes gh-39002
1 parent 93025a0 commit 6bd042e

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -267,8 +267,8 @@ void dbcp2UsesCustomConnectionDetailsWhenDefined() {
267267
DataSource dataSource = context.getBean(DataSource.class);
268268
assertThat(dataSource).asInstanceOf(InstanceOfAssertFactories.type(BasicDataSource.class))
269269
.satisfies((dbcp2) -> {
270-
assertThat(dbcp2.getUsername()).isEqualTo("user-1");
271-
assertThat(dbcp2.getPassword()).isEqualTo("password-1");
270+
assertThat(dbcp2.getUserName()).isEqualTo("user-1");
271+
assertThat(dbcp2).extracting("password").isEqualTo("password-1");
272272
assertThat(dbcp2.getDriverClassName()).isEqualTo(DatabaseDriver.POSTGRESQL.getDriverClassName());
273273
assertThat(dbcp2.getUrl()).isEqualTo("jdbc:customdb://customdb.example.com:12345/database-1");
274274
});

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ void setUsernamePasswordUrlAndDriverClassName() {
4242
new Dbcp2JdbcConnectionDetailsBeanPostProcessor(null).processDataSource(dataSource,
4343
new TestJdbcConnectionDetails());
4444
assertThat(dataSource.getUrl()).isEqualTo("jdbc:customdb://customdb.example.com:12345/database-1");
45-
assertThat(dataSource.getUsername()).isEqualTo("user-1");
46-
assertThat(dataSource.getPassword()).isEqualTo("password-1");
45+
assertThat(dataSource.getUserName()).isEqualTo("user-1");
46+
assertThat(dataSource).extracting("password").isEqualTo("password-1");
4747
assertThat(dataSource.getDriverClassName()).isEqualTo(DatabaseDriver.POSTGRESQL.getDriverClassName());
4848
}
4949

spring-boot-project/spring-boot-dependencies/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ bom {
177177
]
178178
}
179179
}
180-
library("Commons DBCP2", "2.10.0") {
180+
library("Commons DBCP2", "2.11.0") {
181181
group("org.apache.commons") {
182182
modules = [
183183
"commons-dbcp2" {

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,8 @@ private static class MappedDbcp2DataSource extends MappedDataSourceProperties<Ba
644644
add(DataSourceProperty.URL, BasicDataSource::getUrl, BasicDataSource::setUrl);
645645
add(DataSourceProperty.DRIVER_CLASS_NAME, BasicDataSource::getDriverClassName,
646646
BasicDataSource::setDriverClassName);
647-
add(DataSourceProperty.USERNAME, BasicDataSource::getUsername, BasicDataSource::setUsername);
648-
add(DataSourceProperty.PASSWORD, BasicDataSource::getPassword, BasicDataSource::setPassword);
647+
add(DataSourceProperty.USERNAME, BasicDataSource::getUserName, BasicDataSource::setUsername);
648+
add(DataSourceProperty.PASSWORD, null, BasicDataSource::setPassword);
649649
}
650650

651651
}

0 commit comments

Comments
 (0)