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
80ede145
Commit
80ede145
authored
Jun 25, 2018
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.0.x'
parents
a097f923
911453d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
LiquibaseEndpoint.java
...ngframework/boot/actuate/liquibase/LiquibaseEndpoint.java
+8
-2
LiquibaseEndpointTests.java
...mework/boot/actuate/liquibase/LiquibaseEndpointTests.java
+22
-0
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpoint.java
View file @
80ede145
...
...
@@ -80,8 +80,9 @@ public class LiquibaseEndpoint {
try
{
DataSource
dataSource
=
liquibase
.
getDataSource
();
JdbcConnection
connection
=
new
JdbcConnection
(
dataSource
.
getConnection
());
Database
database
=
null
;
try
{
Database
database
=
factory
.
findCorrectDatabaseImplementation
(
connection
);
database
=
factory
.
findCorrectDatabaseImplementation
(
connection
);
String
defaultSchema
=
liquibase
.
getDefaultSchema
();
if
(
StringUtils
.
hasText
(
defaultSchema
))
{
database
.
setDefaultSchemaName
(
defaultSchema
);
...
...
@@ -91,7 +92,12 @@ public class LiquibaseEndpoint {
.
map
(
ChangeSet:
:
new
).
collect
(
Collectors
.
toList
()));
}
finally
{
connection
.
close
();
if
(
database
!=
null
)
{
database
.
close
();
}
else
{
connection
.
close
();
}
}
}
catch
(
Exception
ex
)
{
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpointTests.java
View file @
80ede145
...
...
@@ -16,6 +16,11 @@
package
org
.
springframework
.
boot
.
actuate
.
liquibase
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
javax.sql.DataSource
;
import
org.junit.Test
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
...
...
@@ -62,6 +67,23 @@ public class LiquibaseEndpointTests {
.
hasSize
(
1
));
}
@Test
public
void
connectionAutoCommitPropertyIsReset
()
{
this
.
contextRunner
.
withUserConfiguration
(
Config
.
class
).
run
((
context
)
->
{
DataSource
dataSource
=
context
.
getBean
(
DataSource
.
class
);
assertThat
(
getAutoCommit
(
dataSource
)).
isTrue
();
context
.
getBean
(
LiquibaseEndpoint
.
class
).
liquibaseBeans
();
assertThat
(
getAutoCommit
(
dataSource
)).
isTrue
();
});
}
private
boolean
getAutoCommit
(
DataSource
dataSource
)
throws
SQLException
{
try
(
Connection
connection
=
dataSource
.
getConnection
())
{
System
.
out
.
println
(
connection
);
return
connection
.
getAutoCommit
();
}
}
@Configuration
public
static
class
Config
{
...
...
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