Spring Boot 笔记 (8) - H2 数据库

Maven 依赖

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

Application.yml 配置

  datasource:
    driver-class-name: org.h2.Driver
    url: jdbc:h2:mem:tcm
    username: sa    # 随意配置, 网页访问时一致即可
    password: sa
  jpa:
    database: h2
    hibernate:
      ddl-auto: update
    show-sql: true
  h2:
    console:          # 注意网页版中 url、用户名、密码相一致
      enabled: true   # 开启网页访问
      path: /h2       # 网页访问路径
posted @ 2019-07-26 19:57  质子  阅读(297)  评论(0编辑  收藏  举报