Skip to content

Commit d515595

Browse files
committed
Detect embedded DBs when deducing driver class
Fix DataSourceProperties getUsername() and getPassword() methods to call getDriverClassName() rather than using `this.driverClassName` to ensure than deduced driver classes can be used. Fixes gh-1421
1 parent 5ef45c7 commit d515595

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public String getUsername() {
118118
if (StringUtils.hasText(this.username)) {
119119
return this.username;
120120
}
121-
if (EmbeddedDatabaseConnection.isEmbedded(this.driverClassName)) {
121+
if (EmbeddedDatabaseConnection.isEmbedded(getDriverClassName())) {
122122
return "sa";
123123
}
124124
return null;
@@ -128,7 +128,7 @@ public String getPassword() {
128128
if (StringUtils.hasText(this.password)) {
129129
return this.password;
130130
}
131-
if (EmbeddedDatabaseConnection.isEmbedded(this.driverClassName)) {
131+
if (EmbeddedDatabaseConnection.isEmbedded(getDriverClassName())) {
132132
return "";
133133
}
134134
return null;

0 commit comments

Comments
 (0)