TODO - v2 - not yet reviewed/updated.

The H2ManagerMenu provides a single menu item to redirect to the H2 web console. This is only enabled for prototyping, and only if H2 is detected in the underlying JDBC URL. The menu appears under the "Prototyping" menu.

API & Implementation

The API of the service is:

public class H2ManagerMenu {
    public void openH2Console() { /* ... */ }

Note that this launches the manager on the same host that the webapp runs, and so is only appropriate to use when running on localhost.

Additional Configuration

The following additional configuration is also required (all of this is present in the helloworld and simpleapp starter apps):

  • the h2 jdbc driver is required on the classpath of the webapp:

  • the jdbc:h2 URL configuration properties must be defined, eg in application.properties:

  • finally, and most importantly, the h2 console servlet must be configured in web.xml, and must be mapped to /db:


Disabling/hiding the menu

The menu can be hidden or disabled by subscribing to its domain event, eg:

import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

public class HideH2ManagerMenu {

    public void on(H2ManagerMenu.ActionDomainEvent ev) {