{"id":496,"date":"2015-10-21T18:04:52","date_gmt":"2015-10-21T18:04:52","guid":{"rendered":"http:\/\/installingcats.com\/?p=496"},"modified":"2015-10-21T18:04:52","modified_gmt":"2015-10-21T18:04:52","slug":"h2-web-console-memory-database-spring-boot","status":"publish","type":"post","link":"https:\/\/installingcats.com\/2015\/10\/21\/h2-web-console-memory-database-spring-boot\/","title":{"rendered":"H2 Web Console to In Memory Database – Spring Boot"},"content":{"rendered":"

To get an\u00a0H2 Database Web Console accessing an in-memory database running on Spring Boot:<\/p>\n

    \n
  1. Register\u00a0H2’s WebServlet (with UrlMapping \/console\/*) to your Spring project in a Configuration annotated class. Restart your Application.<\/li>\n
  2. Open a web page to\u00a0http:\/\/localhost:8080\/console\/<\/li>\n
  3. Be sure you’re accessing the correct database JDBC URL (default would be\u00a0jdbc:h2:mem:testdb<\/strong>)<\/li>\n<\/ol>\n

    (Credit: Spring Framework Guru<\/a>)<\/p>\n

     <\/p>\n

    \nimport org.h2.server.web.WebServlet;\nimport org.springframework.boot.context.embedded.ServletRegistrationBean;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;<\/pre>\n
    @Configuration\npublic class H2ConsoleWebConfiguration {\n @Bean\n ServletRegistrationBean h2servletRegistration() {\n ServletRegistrationBean registrationBean = new ServletRegistrationBean(new WebServlet());\n registrationBean.addUrlMappings(\"\/console\/*\");\n return registrationBean;\n }\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"

    To get an\u00a0H2 Database Web Console accessing an in-memory database running on Spring Boot: Register\u00a0H2’s WebServlet (with UrlMapping \/console\/*) to your Spring project in a Configuration annotated class. Restart your Application. Open a web page to\u00a0http:\/\/localhost:8080\/console\/ Be sure you’re accessing the correct database JDBC URL (default would be\u00a0jdbc:h2:mem:testdb) (Credit: Spring Framework Guru)   import org.h2.server.web.WebServlet; […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,248],"tags":[247],"_links":{"self":[{"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/posts\/496"}],"collection":[{"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/comments?post=496"}],"version-history":[{"count":0,"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/posts\/496\/revisions"}],"wp:attachment":[{"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/media?parent=496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/categories?post=496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/installingcats.com\/wp-json\/wp\/v2\/tags?post=496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}