Spring Boot 2 正确地初始化data.sql和schema.sql脚本

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Fighting_mjtao/article/details/82788106

我尝试了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

猜你喜欢

转载自blog.csdn.net/Fighting_mjtao/article/details/82788106