H2DB的默认URL和凭据? [英] Default url and credentials for H2DB?

查看:134
本文介绍了H2DB的默认URL和凭据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆