博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
H2 Web Console to In Memory Database – Spring Boot
阅读量:7237 次
发布时间:2019-06-29

本文共 954 字,大约阅读时间需要 3 分钟。

  hot3.png

To get an H2 Database Web Console accessing an in-memory database running on Spring Boot:

  1. Register H2’s WebServlet (with UrlMapping /console/*) to your Spring project in a Configuration annotated class. Restart your Application.
  2. Open a web page to http://localhost:8080/console/
  3. Be sure you’re accessing the correct database JDBC URL (default would be jdbc:h2:mem:testdb)

(Credit: )

import org.h2.server.web.WebServlet;import org.springframework.boot.context.embedded.ServletRegistrationBean;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;@Configurationpublic class H2ConsoleWebConfiguration {    @Bean    ServletRegistrationBean h2servletRegistration() {        ServletRegistrationBean registrationBean = new ServletRegistrationBean(new WebServlet());        registrationBean.addUrlMappings("/console/*");        return registrationBean;    }}

转载于:https://my.oschina.net/boltwu/blog/776346

你可能感兴趣的文章
pip选择新源的方法
查看>>
经典的”服务器最多65536个连接”误解
查看>>
python构建bp神经网络_鸢尾花分类(一个隐藏层)__2.代码实现
查看>>
Unix命令一句话解释
查看>>
Linux服务的控制和管理原理
查看>>
Advanced+Apple+Debugging(8)
查看>>
ida 二进制文件对比工具
查看>>
封装类的装箱及拆箱
查看>>
Cisco dhcp 服务器配置
查看>>
replace into .. ON DUPLICATE KEY更新多行记录
查看>>
jq点击增加一段html
查看>>
Excel 2013 基础视频教程上线了
查看>>
我的友情链接
查看>>
kvm虚拟机块对齐问题研究
查看>>
linux svn服务器搭建、客户端操作、备份与恢复
查看>>
CentOS7使用firewalld打开关闭防火墙与端口
查看>>
我的友情链接
查看>>
bash的基础特性(1)
查看>>
IP SLA
查看>>
Ucenter原理及第三方应用程序整合思路、方法简述
查看>>