I am happy to post another blog post on how to integrate H2 database in your Spring Boot Application.
In this tutorial we will be using the H2 database in embedded mode.
You have created a spring boot application and like to integrate with h2 database.
In pom.xml add the below dependency.
In applciation.properties file add the below line to enable the h2 database.
# H2 spring.h2.console.enabled=true spring.h2.console.path=/h2 # Datasource spring.datasource.url=jdbc:h2:file:~/test spring.datasource.username=sa spring.datasource.password= spring.datasource.driver-class-name=org.h2.Driver
Take a maven build and run the application as spring boot app.
Open a browser and type
http://localhost:8080/h2 to get the below image.
The above yellow highlighted lines should match your application.properties file.
If you get stuck, kindly comment below.
Ask me your questions/ doubt in quora.
Thanks for reading this post. Subscribe my blog for some awesome posts.