程序员SpringBoot极简教程 · Spring Boot

Spring Boot : H2 数据库

2018-01-22  本文已影响1300人  聪明的奇瑞

H2 数据库

logging.level.org.hibernate=DEBUG  

Spring Boot 整合 H2

引入 H2 依赖

<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <scope>runtime</scope>
</dependency>

配置 H2 数据库

spring:
  h2:
    console:
      path: /h2-console   # h2 web consloe 路径
      enabled: true       # 开启 h2 web consloe,默认为 false
      settings:
        web-allow-others: true    #允许远程访问 h2 web consloe
  datasource:
    username: sa
    url: jdbc:h2:mem:test
    driver-class-name:  org.h2.Driver

通过 URL:http://localhost:8080/h2-console/ 访问数据库管理界面

WX20180122-102715@2x.png
上一篇下一篇

猜你喜欢

热点阅读