From d515595ca14b44d125608d478aae4a4c54b07afd Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 21 Aug 2014 22:06:01 -0700 Subject: [PATCH] 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 --- .../boot/autoconfigure/jdbc/DataSourceProperties.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java index d42222a848..b734a34091 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java @@ -118,7 +118,7 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB if (StringUtils.hasText(this.username)) { return this.username; } - if (EmbeddedDatabaseConnection.isEmbedded(this.driverClassName)) { + if (EmbeddedDatabaseConnection.isEmbedded(getDriverClassName())) { return "sa"; } return null; @@ -128,7 +128,7 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB if (StringUtils.hasText(this.password)) { return this.password; } - if (EmbeddedDatabaseConnection.isEmbedded(this.driverClassName)) { + if (EmbeddedDatabaseConnection.isEmbedded(getDriverClassName())) { return ""; } return null;