29.4 Using H2’s web console
The H2 database provides a browser-based console that Spring Boot can auto-configure for you. The console will be auto-configured when the following conditions are met:
- You are developing a web application
com.h2database:h2
is on the classpath- You are using Spring Boot’s developer tools
Tip | |
---|---|
If you are not using Spring Boot’s developer tools, but would still like to make use of H2’s console, then you can do so by configuring the spring.h2.console.enabled property with a value of true . The H2 console is only intended for use during development so care should be taken to ensure that spring.h2.console.enabled is not set to true in production. |
29.4.1 Changing the H2 console’s path
By default the console will be available at /h2-console
. You can customize the console’s path using the spring.h2.console.path
property.
29.4.2 Securing the H2 console
When Spring Security is on the classpath and basic auth is enabled, the H2 console will be automatically secured using basic auth. The following properties can be used to customize the security configuration:
security.user.role
security.basic.authorize-mode
security.basic.enabled