Skip to content

Commit a899058

Browse files
committed
Add a tip to the docs about using DB_CLOSE_ON_EXIT=false with H2
Closes gh-4135
1 parent 5af0903 commit a899058

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,6 +2081,11 @@ For example, typical POM dependencies would be:
20812081
</dependency>
20822082
----
20832083

2084+
TIP: If you're using H2 and, for whatever reason, you do configure its connection URL,
2085+
care should be taken to disable the database's automatic shutdown using
2086+
`DB_CLOSE_ON_EXIT=FALSE`. This allows Spring Boot to control when the database is closed,
2087+
thereby ensuring that it happens once access to the database is no longer needed.
2088+
20842089
NOTE: You need a dependency on `spring-jdbc` for an embedded database to be
20852090
auto-configured. In this example it's pulled in transitively via
20862091
`spring-boot-starter-data-jpa`.

0 commit comments

Comments
 (0)