最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

springboot2自動加載sql文件的實(shí)現(xiàn)

 更新時間:2023年11月22日 16:01:17   作者:Mihu_Tutu  
本文主要介紹了springboot2自動加載sql文件的實(shí)現(xiàn),通過配置文件或注解的方式,我們可以輕松地將SQL語句映射到數(shù)據(jù)庫中,實(shí)現(xiàn)自動加載,感興趣的可以了解一下

1. Spring Boot 2 初始化數(shù)據(jù)庫腳本 data.sql & user.sql

user.sql :數(shù)據(jù)表結(jié)構(gòu)
data.sql :數(shù)據(jù)內(nèi)容

2. 文件放置的位置 如下表:

3. application.yml 配置寫法

pring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/db?serverTimezone=GMT%2B8
    username: root
    password: root
#    自動加生成表格和加載數(shù)據(jù)
#    schema-username: root
#    schema-password: root
#    data-username: root
#    data-password: root
    platform: mysql
    schema: classpath:sql/*.sql
    data: classpath:sql/data/*.sql
    continue-on-error: true
    initialization-mode: always

到此這篇關(guān)于springboot2自動加載sql文件的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)springboot自動加載sql內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

甘孜县| 遵化市| 简阳市| 寻乌县| 南投县| 横山县| 巫山县| 嫩江县| 思南县| 克什克腾旗| 信宜市| 尼木县| 五寨县| 荆州市| 金堂县| 南充市| 普安县| 潼关县| 澳门| 南江县| 谢通门县| 溆浦县| 临邑县| 且末县| 吉林市| 镇远县| 迁西县| 湘潭县| 惠州市| 应城市| 宁津县| 凉山| 新龙县| 儋州市| 宜都市| 青阳县| 景洪市| 阳曲县| 上饶县| 安溪县| 应城市|