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
9a4a2053
Commit
9a4a2053
authored
May 15, 2017
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
198093c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
LiquibaseAutoConfiguration.java
...t/autoconfigure/liquibase/LiquibaseAutoConfiguration.java
+16
-14
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java
View file @
9a4a2053
...
...
@@ -116,18 +116,14 @@ public class LiquibaseAutoConfiguration {
}
private
SpringLiquibase
createSpringLiquibase
()
{
SpringLiquibase
liquibase
;
DataSource
dataSourceToUse
=
getDataSource
();
if
(
dataSourceToUse
==
null
)
{
dataSourceToUse
=
DataSourceBuilder
.
create
().
url
(
this
.
properties
.
getUrl
())
.
username
(
this
.
properties
.
getUser
())
.
password
(
this
.
properties
.
getPassword
()).
build
();
liquibase
=
new
DataSourceClosingSpringLiquibase
();
DataSource
liquibaseDataSource
=
getDataSource
();
if
(
liquibaseDataSource
!=
null
)
{
SpringLiquibase
liquibase
=
new
SpringLiquibase
();
liquibase
.
setDataSource
(
liquibaseDataSource
);
return
liquibase
;
}
else
{
liquibase
=
new
SpringLiquibase
();
}
liquibase
.
setDataSource
(
dataSourceToUse
);
SpringLiquibase
liquibase
=
new
DataSourceClosingSpringLiquibase
();
liquibase
.
setDataSource
(
createNewDataSource
());
return
liquibase
;
}
...
...
@@ -135,12 +131,18 @@ public class LiquibaseAutoConfiguration {
if
(
this
.
liquibaseDataSource
!=
null
)
{
return
this
.
liquibaseDataSource
;
}
else
if
(
this
.
properties
.
getUrl
()
==
null
)
{
if
(
this
.
properties
.
getUrl
()
==
null
)
{
return
this
.
dataSource
;
}
return
null
;
}
private
DataSource
createNewDataSource
()
{
return
DataSourceBuilder
.
create
().
url
(
this
.
properties
.
getUrl
())
.
username
(
this
.
properties
.
getUser
())
.
password
(
this
.
properties
.
getPassword
()).
build
();
}
}
/**
...
...
@@ -172,8 +174,8 @@ public class LiquibaseAutoConfiguration {
}
private
void
closeDataSource
()
{
Method
closeMethod
=
ReflectionUtils
.
findMethod
(
getDataSource
().
getClass
(),
"close"
);
Class
<?>
dataSourceClass
=
getDataSource
().
getClass
();
Method
closeMethod
=
ReflectionUtils
.
findMethod
(
dataSourceClass
,
"close"
);
if
(
closeMethod
!=
null
)
{
ReflectionUtils
.
invokeMethod
(
closeMethod
,
getDataSource
());
}
...
...
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