The easiest way is to use initializer implementing directly WebApplicationInitializer and the add into onStartup(ServletContext servletContext)
method following code;
ServletRegistration.Dynamic h2Servlet = servletContext.addServlet("h2Servlet", new org.h2.server.web.WebServlet());
h2Servlet.setLoadOnStartup(1);
h2Servlet.addMapping("/h2/*");