Skip to content

Commit b11457f

Browse files
committed
Merge pull request #6118 from joshiste/1.3.x-liquibase-endpoint
* 1.3.x-liquibase-endpoint: Close connection after use in LiquibaseEndpoint
2 parents 452281c + e89063c commit b11457f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@ public LiquibaseEndpoint(SpringLiquibase liquibase) {
5454
DatabaseFactory factory = DatabaseFactory.getInstance();
5555
DataSource dataSource = this.liquibase.getDataSource();
5656
JdbcConnection connection = new JdbcConnection(dataSource.getConnection());
57-
Database database = factory.findCorrectDatabaseImplementation(connection);
58-
return service.queryDatabaseChangeLogTable(database);
57+
try {
58+
Database database = factory.findCorrectDatabaseImplementation(connection);
59+
return service.queryDatabaseChangeLogTable(database);
60+
}
61+
finally {
62+
connection.close();
63+
}
5964
}
6065
catch (Exception ex) {
6166
throw new IllegalStateException("Unable to get Liquibase changelog", ex);

0 commit comments

Comments
 (0)