如何从Spring Boot连接到H2控制台?

问题描述 投票:0回答:1
driverClassName=org.h2.Driver
url=jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1
username=sa
password=sa

hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=create-drop
spring.h2.console.enabled=true

错误的用户名或密码,为什么?

enter image description here

java spring spring-boot h2
1个回答
0
投票

在您的application.properties中

spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

请参阅此tutorial

© www.soinside.com 2019 - 2024. All rights reserved.