I have added H2DB in my springBoot application for unit testing purpose.
In application-test.properties I just added:
spring.datasource.name = h2db
spring.h2.console.enabled = true
Its working fine, saving the values.
But how it is working and how can I browse this DB?
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
So it's not necessary to add them to your application.properties
- Spring Boot create this DB itself.
If you want to get access to your H2 DB right from your IDE you have to make this setup.