1 回答
TA贡献1839条经验 获得超15个赞
在应用程序属性中添加
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 防止连接丢失
更新
对于直接来自 Spring Initialzr 的 Spring Boot 2.x:
devtools 默认是http://127.0.0.1:8080/h2-console/
POM: spring-boot-starter, h2, spring-boot-starter-web, spring-boot-devtools
没有 devtools - 你需要在属性中设置它:
spring.h2.console.enabled=true spring.h2.console.path=/h2-console
POM: spring-boot-starter, h2, spring-boot-starter-web
添加回答
举报
