You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update `FlywayAutoConfiguration`, `LiquibaseAutoConfiguration` and
`DataSourceInitializer` classes so that they no longer depend on
`DataSourceProperties`. DB migrations can now be performed against
a `@Bean` defined primary `DataSource` with an alternative
username/password.
This update also removed using fallback properties when a custom
connection `url` is defined with Flyway or Liquibase. We now assume
that `username`, `password` and `driver-class-name` will be provided
if the default values are unacceptable. Our previous logic was
particularly flawed if a custom URL caused a change of driver type.
Closesgh-25643
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java
+33-14Lines changed: 33 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -161,12 +161,6 @@ public class FlywayProperties {
161
161
*/
162
162
privateStringtarget;
163
163
164
-
/**
165
-
* JDBC url of the database to migrate. If not set, the primary configured data source
166
-
* is used.
167
-
*/
168
-
privateStringurl;
169
-
170
164
/**
171
165
* Login user of the database to migrate.
172
166
*/
@@ -177,6 +171,17 @@ public class FlywayProperties {
177
171
*/
178
172
privateStringpassword;
179
173
174
+
/**
175
+
* Fully qualified name of the JDBC driver. Auto-detected based on the URL by default.
176
+
*/
177
+
privateStringdriverClassName;
178
+
179
+
/**
180
+
* JDBC url of the database to migrate. If not set, the primary configured data source
181
+
* is used.
182
+
*/
183
+
privateStringurl;
184
+
180
185
/**
181
186
* SQL statements to execute to initialize a connection immediately after obtaining
182
187
* it.
@@ -538,18 +543,16 @@ public void setTarget(String target) {
538
543
this.target = target;
539
544
}
540
545
546
+
/**
547
+
* Return if a new datasource is being created.
548
+
* @return {@code true} if a new datasource is created
549
+
* @deprecated since 2.5.0 in favor of directly checking user and url.
550
+
*/
551
+
@Deprecated
541
552
publicbooleanisCreateDataSource() {
542
553
returnthis.url != null || this.user != null;
543
554
}
544
555
545
-
publicStringgetUrl() {
546
-
returnthis.url;
547
-
}
548
-
549
-
publicvoidsetUrl(Stringurl) {
550
-
this.url = url;
551
-
}
552
-
553
556
publicStringgetUser() {
554
557
returnthis.user;
555
558
}
@@ -566,6 +569,22 @@ public void setPassword(String password) {
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java
0 commit comments