Add H2 to Maven dependencies
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
Add properties to the application context
spring.h2.console.enabled=true
spring.h2.console.path=/h2
db.driver.class.name=org.h2.Driver
db.url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
db.username=
db.password=
Disable frame options in web security configuration
@Configuration
@EnableWebSecurity
@Profile("local")
public class WebSecurityConfigurationLocal extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
// Permissions
// ...
// For H2 web console
http.headers().frameOptions().disable();
}
}
Open /h2 and login with:
- JDBC URL: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
- Username:
- Password: