I am using R2DBC-H2 driver, and my UR.L is spring.r2dbc.url=r2dbc:h2:mem:///customer
Using this configuration, SpringBoot starts fine, however, I can not access the h2-console.
Does anybody know why, and how I can fix it?
I am using R2DBC-H2 driver, and my UR.L is spring.r2dbc.url=r2dbc:h2:mem:///customer
Using this configuration, SpringBoot starts fine, however, I can not access the h2-console.
Does anybody know why, and how I can fix it?
H2 Console depends on traditional JDBC drivers, not compatible with the Spring WebFlux stack.
If you are developing a WebFlux application, you can use H2 as a standalone database, and use H2 Console freely.
spring.r2dbc.url
to the database URL you are running in the first step.NOTE: Do not use a Memory DB here.
If I understand the source code of H2ConsoleAutoConfiguration
correctly, the h2 console auto configuration from spring boot does not work in a reactive environment.
...
@ConditionalOnWebApplication(type = Type.SERVLET)
...
public class H2ConsoleAutoConfiguration {
You can confirm this by yourself by changing the type of your web application to SERVLET (for example, by adding spring-boot-starter-web
as a dependency) which will activate the route to the h2 console (if enabled in the application properties). The h2-console route endpoint will start working again.
As the whole code seems very servlet-specific, I don't know how to properly fix this problem.
© 2022 - 2024 — McMap. All rights reserved.