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
1c6e37b2
Commit
1c6e37b2
authored
Sep 18, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.3.x'
Closes gh-23409
parents
d2fae6e1
55bfef99
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
FlywayAutoConfiguration.java
...rk/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
+3
-4
FlywayAutoConfigurationTests.java
...ot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
+18
-0
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
View file @
1c6e37b2
...
@@ -145,10 +145,6 @@ public class FlywayAutoConfiguration {
...
@@ -145,10 +145,6 @@ public class FlywayAutoConfiguration {
String
user
=
getProperty
(
properties:
:
getUser
,
dataSourceProperties:
:
determineUsername
);
String
user
=
getProperty
(
properties:
:
getUser
,
dataSourceProperties:
:
determineUsername
);
String
password
=
getProperty
(
properties:
:
getPassword
,
dataSourceProperties:
:
determinePassword
);
String
password
=
getProperty
(
properties:
:
getPassword
,
dataSourceProperties:
:
determinePassword
);
configuration
.
dataSource
(
url
,
user
,
password
);
configuration
.
dataSource
(
url
,
user
,
password
);
if
(!
CollectionUtils
.
isEmpty
(
properties
.
getInitSqls
()))
{
String
initSql
=
StringUtils
.
collectionToDelimitedString
(
properties
.
getInitSqls
(),
"\n"
);
configuration
.
initSql
(
initSql
);
}
}
}
else
if
(
flywayDataSource
!=
null
)
{
else
if
(
flywayDataSource
!=
null
)
{
configuration
.
dataSource
(
flywayDataSource
);
configuration
.
dataSource
(
flywayDataSource
);
...
@@ -210,6 +206,9 @@ public class FlywayAutoConfiguration {
...
@@ -210,6 +206,9 @@ public class FlywayAutoConfiguration {
map
.
from
(
properties
.
isSkipDefaultResolvers
()).
to
(
configuration:
:
skipDefaultResolvers
);
map
.
from
(
properties
.
isSkipDefaultResolvers
()).
to
(
configuration:
:
skipDefaultResolvers
);
configureValidateMigrationNaming
(
configuration
,
properties
.
isValidateMigrationNaming
());
configureValidateMigrationNaming
(
configuration
,
properties
.
isValidateMigrationNaming
());
map
.
from
(
properties
.
isValidateOnMigrate
()).
to
(
configuration:
:
validateOnMigrate
);
map
.
from
(
properties
.
isValidateOnMigrate
()).
to
(
configuration:
:
validateOnMigrate
);
map
.
from
(
properties
.
getInitSqls
()).
whenNot
(
CollectionUtils:
:
isEmpty
)
.
as
((
initSqls
)
->
StringUtils
.
collectionToDelimitedString
(
initSqls
,
"\n"
))
.
to
(
configuration:
:
initSql
);
// Pro properties
// Pro properties
map
.
from
(
properties
.
getBatch
()).
whenNonNull
().
to
(
configuration:
:
batch
);
map
.
from
(
properties
.
getBatch
()).
whenNonNull
().
to
(
configuration:
:
batch
);
map
.
from
(
properties
.
getDryRunOutput
()).
whenNonNull
().
to
(
configuration:
:
dryRunOutput
);
map
.
from
(
properties
.
getDryRunOutput
()).
whenNonNull
().
to
(
configuration:
:
dryRunOutput
);
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java
View file @
1c6e37b2
...
@@ -502,6 +502,24 @@ class FlywayAutoConfigurationTests {
...
@@ -502,6 +502,24 @@ class FlywayAutoConfigurationTests {
});
});
}
}
@Test
void
initSqlsWithDataSource
()
{
this
.
contextRunner
.
withUserConfiguration
(
EmbeddedDataSourceConfiguration
.
class
)
.
withPropertyValues
(
"spring.flyway.init-sqls=SELECT 1"
).
run
((
context
)
->
{
Flyway
flyway
=
context
.
getBean
(
Flyway
.
class
);
assertThat
(
flyway
.
getConfiguration
().
getInitSql
()).
isEqualTo
(
"SELECT 1"
);
});
}
@Test
void
initSqlsWithFlywayUrl
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.flyway.url:jdbc:h2:mem:"
+
UUID
.
randomUUID
(),
"spring.flyway.init-sqls=SELECT 1"
).
run
((
context
)
->
{
Flyway
flyway
=
context
.
getBean
(
Flyway
.
class
);
assertThat
(
flyway
.
getConfiguration
().
getInitSql
()).
isEqualTo
(
"SELECT 1"
);
});
}
@Configuration
(
proxyBeanMethods
=
false
)
@Configuration
(
proxyBeanMethods
=
false
)
static
class
FlywayDataSourceConfiguration
{
static
class
FlywayDataSourceConfiguration
{
...
...
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