runtimeOnly 'com.h2database:h2
in dependencies sectionspring.datasource.url=jdbc:h2:mem:testdb spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password= spring.h2.console.enabled=true
Note that we set console.enable to true so that we can access H2 by web browser
For maven:
<dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency>