java - 如何从Spring boot连接到H2控制台?

标签 java spring spring-boot h2

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

最佳答案

在你的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

关于java - 如何从Spring boot连接到H2控制台?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58685018/

相关文章:

java - AJAX/Spring MVC - 没有 Spring Security 的 403 禁止错误

java - 使用注释的条件唯一约束

多次调用 Spring 安全自定义过滤器

java - 如何使用 Spring @Configuration 覆盖导入的资源?

java - 尽管允许,但未经授权的请求

spring-boot - 使用 Keycloak 和 Spring Boot 的 Multi-Tenancy

如果存在内部类,则包含美元符号的 Java 类名无法编译

java - 如何从java JUnit中的.properties文件获取文件名?

java, spring boot 在运行时自动生成 getter 和 setter

java - "aggregate-oriented domain"意味着什么(谈到基于 Spring 的应用程序)?