1 回答

TA貢獻(xiàn)1839條經(jīng)驗(yàn) 獲得超15個(gè)贊
在應(yīng)用程序?qū)傩灾刑砑?/p>
spring.h2.console.path=/h2-console
H2 的屬性
spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.path=/h2-console
DB_CLOSE_DELAY = -1 防止連接丟失
更新
對(duì)于直接來(lái)自 Spring Initialzr 的 Spring Boot 2.x:
devtools 默認(rèn)是http://127.0.0.1:8080/h2-console/
POM: spring-boot-starter, h2, spring-boot-starter-web, spring-boot-devtools
沒(méi)有 devtools - 你需要在屬性中設(shè)置它:
spring.h2.console.enabled=true spring.h2.console.path=/h2-console
POM: spring-boot-starter, h2, spring-boot-starter-web
添加回答
舉報(bào)