Add this to your pom.xml:
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
# H2 Console Configuration
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
# H2 Database Connection
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=admin_viewer
spring.datasource.password=password
# JPA/Hibernate Settings
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
After running your application, access the console at:
<http://localhost:8080/h2-console>
Login credentials:
jdbc:h2:mem:testdbadmin_viewerpasswordQuick Notes:
mem:testdb = in-memory database (data lost on restart)ddl-auto=update = auto-creates/updates tablesshow-sql=true = displays SQL queries in console