Prevent H2 from closing on exit to allow destruction (#2707)

#### What type of PR is this?

/kind bug
/area core

#### What this PR does / why we need it:

Before this, `CounterMeterHandler#stop` will encounter an error when Halo is graceful shutdown due to database closed before.

```java
2022-11-16T15:52:17.904+08:00 DEBUG 21324 --- [ionShutdownHook] r.halo.app.metrics.CounterMeterHandler   : Persist counter meters to database before destroy...
2022-11-16T15:52:17.910+08:00 ERROR 21324 --- [ionShutdownHook] r.halo.app.metrics.CounterMeterHandler   : Persist counter meters to database failed.

org.springframework.dao.DataAccessResourceFailureException: Failed to obtain R2DBC Connection
	at org.springframework.r2dbc.connection.ConnectionFactoryUtils.lambda$getConnection$0(ConnectionFactoryUtils.java:88) ~[spring-r2dbc-6.0.0-RC4.jar:6.0.0-RC4]
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
```

#### Special notes for your reviewer:

Steps to test:

1. Start Halo and then stop it
2. See the log detail

#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/2712/head
John Niang 2022-11-16 18:56:20 +08:00 committed by GitHub
parent f1ac4e3740
commit cc984b2bb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -7,7 +7,7 @@ spring:
ansi: ansi:
enabled: detect enabled: detect
r2dbc: r2dbc:
url: r2dbc:h2:file:///${halo.work-dir}/db/halo-next?options=AUTO_SERVER=TRUE;MODE=MySQL url: r2dbc:h2:file:///${halo.work-dir}/db/halo-next?MODE=MySQL&DB_CLOSE_ON_EXIT=FALSE
username: admin username: admin
password: 123456 password: 123456
sql: sql: