1. 程式人生 > >Spring Boot 2 正確地初始化data.sql和schema.sql指令碼

Spring Boot 2 正確地初始化data.sql和schema.sql指令碼

我嘗試了csdn的各種方案,都是在控制檯輸出日誌中沒有執行sql的日誌資訊,然後百度到一個spring2.0方案,

然後就正常輸出了

application.yml配置如下

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/jdbc
    username: root
    password: root
    driver-class-name: com.mysql.jdbc.Driver
    data-username: root
    data-password: root
    schema-username: root
    schema-password: root
    schema:
      - classpath:department.sql #注意書寫方式,-後面有一個空格,classpath:name.sql中間卻沒有空格
      - classpath:employee.sql
    initialization-mode: always