Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.mycompany.testfile.config; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRegistration; import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; import org.springframework.boot.context.embedded.ServletContextInitializer; import org.springframework.context.annotation.Configuration; /** * @author pramoth */ @Configuration public class WebConfig implements ServletContextInitializer, EmbeddedServletContainerCustomizer { @Override public void onStartup(ServletContext servletContext) throws ServletException { ServletRegistration.Dynamic h2ConsoleServlet = servletContext.addServlet("H2Console", new org.h2.server.web.WebServlet()); h2ConsoleServlet.addMapping("/console/*"); h2ConsoleServlet.setInitParameter("-properties", "src/main/resources"); h2ConsoleServlet.setLoadOnStartup(1); } @Override public void customize(ConfigurableEmbeddedServletContainer servletContext) { } }