I am building a new Spring boot application with h2 db in WebFlux stack along with Netflix DGS. I want to access h2 DB console. I have used following configuration but I am not able to access my H2 DB console with this config. Though db is spinning up and during application startup I can able to load the data into DB programattically.
gradle file
------------
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation(platform("com.netflix.graphql.dgs:graphql-dgs-platform-dependencies:5.5.5"))
implementation 'com.netflix.graphql.dgs:graphql-dgs-webflux-starter:5.5.5'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.h2database:h2'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
}
application.yml
---------------
spring:
config:
activate:
on-profile: local
graphql:
graphiql:
#http://localhost:8080/graphiql
enabled: true
datasource:
url: jdbc:h2:mem:testdb;MODE=PostgreSQL
driverClassName: org.h2.Driver
username: sa
password: password
h2:
console:
enabled: true
path: /h2-console
If I try to access H2 console url getting 404 error.
this is my URL - http://localhost:8080/h2-console/
H2ConsoleAutoConfiguration
is not available for spring webflux. You may have to configure the H2 configuration manually by defining a Server for your H2 Console. You can create a webserver in your code and then try to work with that.