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
添加回答
舉報