Featured image of post H2Database之配置檔紀錄

H2Database之配置檔紀錄

太常用了,所以紀錄一下

依賴如下

1
2
3
4
5
   <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>

配置如下

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
server.port=8080
spring.h2.console.enabled=true
spring.h2.console.path=/h2
spring.sql.init.mode=always
spring.datasource.url=jdbc:h2:~/dev;AUTO_SERVER=true
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=sa
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
server:
  port: 8080
spring:
  h2:
    console:
      enabled: true
      path: /h2
  sql:
    init:
      mode: always
  datasource:
    url: jdbc:h2:~/test;AUTO_SERVER=true # ??????C/user/userName?????
    driver-class-name: org.h2.Driver #??driver
    username: sa
    password: sa
  jpa:
    database-platform: org.hibernate.dialect.H2Dialect
    hibernate:
      ddl-auto: update

Licensed under CC BY-NC-SA 4.0