Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
1a9065f4
Commit
1a9065f4
authored
Mar 23, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.2.x'
Closes gh-20621
parents
34b71561
62f696d5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
FlywayAutoConfiguration.java
...rk/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
+1
-1
FlywayAutoConfigurationTests.java
...ot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
+31
-0
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
View file @
1a9065f4
...
...
@@ -125,7 +125,7 @@ public class FlywayAutoConfiguration {
ObjectProvider
<
JavaMigration
>
javaMigrations
,
ObjectProvider
<
Callback
>
callbacks
)
{
FluentConfiguration
configuration
=
new
FluentConfiguration
(
resourceLoader
.
getClassLoader
());
DataSource
dataSourceToMigrate
=
configureDataSource
(
configuration
,
properties
,
dataSourceProperties
,
flywayDataSource
.
getIfAvailable
(),
dataSource
.
getIf
Availabl
e
());
flywayDataSource
.
getIfAvailable
(),
dataSource
.
getIf
Uniqu
e
());
checkLocationExists
(
dataSourceToMigrate
,
properties
,
resourceLoader
);
configureProperties
(
configuration
,
properties
);
List
<
Callback
>
orderedCallbacks
=
callbacks
.
orderedStream
().
collect
(
Collectors
.
toList
());
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
View file @
1a9065f4
...
...
@@ -77,6 +77,7 @@ import static org.mockito.Mockito.mock;
* @author Stephane Nicoll
* @author Dominic Gunn
* @author András Deák
* @author Takaaki Shimbo
*/
@ExtendWith
(
OutputCaptureExtension
.
class
)
class
FlywayAutoConfigurationTests
{
...
...
@@ -162,6 +163,15 @@ class FlywayAutoConfigurationTests {
});
}
@Test
void
flywayMultipleDataSources
()
{
this
.
contextRunner
.
withUserConfiguration
(
FlywayMultipleDataSourcesConfiguration
.
class
).
run
((
context
)
->
{
assertThat
(
context
).
hasSingleBean
(
Flyway
.
class
);
assertThat
(
context
.
getBean
(
Flyway
.
class
).
getConfiguration
().
getDataSource
())
.
isEqualTo
(
context
.
getBean
(
"flywayDataSource"
));
});
}
@Test
void
schemaManagementProviderDetectsDataSource
()
{
this
.
contextRunner
...
...
@@ -509,6 +519,27 @@ class FlywayAutoConfigurationTests {
}
@Configuration
(
proxyBeanMethods
=
false
)
static
class
FlywayMultipleDataSourcesConfiguration
{
@Bean
DataSource
firstDataSource
()
{
return
DataSourceBuilder
.
create
().
url
(
"jdbc:hsqldb:mem:first"
).
username
(
"sa"
).
build
();
}
@Bean
DataSource
secondDataSource
()
{
return
DataSourceBuilder
.
create
().
url
(
"jdbc:hsqldb:mem:second"
).
username
(
"sa"
).
build
();
}
@FlywayDataSource
@Bean
DataSource
flywayDataSource
()
{
return
DataSourceBuilder
.
create
().
url
(
"jdbc:hsqldb:mem:flywaytest"
).
username
(
"sa"
).
build
();
}
}
@Configuration
(
proxyBeanMethods
=
false
)
static
class
FlywayJavaMigrationsConfiguration
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment