Sha*_*rad 2 spring-data-jpa h2db spring-boot
我已经在springBoot应用程序中添加了H2DB以进行单元测试。
我在application-test.properties中添加了:
spring.datasource.name = h2db
spring.h2.console.enabled = true
它的工作正常,保存值。
但是它是如何工作的以及如何浏览该数据库?
Spring Boot应用程序中H2的默认属性是:
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
Run Code Online (Sandbox Code Playgroud)
因此,没有必要将它们添加到您的application.properties-Spring Boot中来创建该数据库本身。
如果要直接从IDE中访问H2 DB,则必须进行此设置。
| 归档时间: |
|
| 查看次数: |
2921 次 |
| 最近记录: |