zoukankan      html  css  js  c++  java
  • SpringBoot2.x整合JDBC及初始化data.sql和schema.sql脚本

    今天在使用SpringBoot2.x版本整合JDBC时遇到了一些问题;由于我之前一直用SpringBoot1.5的版本,所以直接在yml里按照1.5的版本配置了属性,没想到2.x直接不能用了。首先是数据库驱动改变了:

    Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is
    generally unnecessary.


      以前的驱动
    jdbc.driverClass = com.mysql.dbc.Driver

    现在的驱动

    jdbc.driverClass = com.mysql.cj.jdbc.Driver

    然后是自动初始化sql脚本的问题,1.5的版本只要将脚本命名为schama-*.sql,放在classpath下启动项目就能自动执行该脚本语句,到了2.x版本则需要增加如下配置:

    schema-username: root
    schema-password: 123456
    data-username: root
    data-password: 123456
    platform: mysql
    schema: classpath:schema-*.sql
    continue-on-error: true
    initialization-mode: always
  • 相关阅读:
    php基本语法学习
    mac下charles使用
    python--logging模块
    CSS样式(二)
    CSS样式(一)
    HTML、CSS基础知识(四)
    HTML、CSS基础知识(三)
    HTML、CSS基础知识(二)
    HTML、CSS基础知识(一)
    python学习(三十四)第一个框架
  • 原文地址:https://www.cnblogs.com/wangxiayun/p/10069848.html
Copyright © 2011-2022 走看看