H2DB的默认URL和凭据? [英] Default url and credentials for H2DB?
问题描述
我已经在springBoot应用程序中添加了H2DB,用于单元测试.
I have added H2DB in my springBoot application for unit testing purpose.
我刚刚在application-test.properties中添加了
In application-test.properties I just added:
spring.datasource.name = h2db
spring.datasource.name = h2db
spring.h2.console.enabled = true
spring.h2.console.enabled = true
它工作正常,保存了值.
Its working fine, saving the values.
但是它如何工作以及如何浏览该数据库?
But how it is working and how can I browse this DB?
推荐答案
Spring Boot应用程序中H2的默认属性是:
Default properties for H2 in Spring Boot application are:
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
因此没有必要将它们添加到您的application.properties
中-Spring Boot自己创建此数据库.
So it's not necessary to add them to your application.properties
- Spring Boot create this DB itself.
如果您想直接从IDE中访问H2 DB,则必须进行此设置.
If you want to get access to your H2 DB right from your IDE you have to make this setup.
这篇关于H2DB的默认URL和凭据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!