栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

在Spring Boot中为liquibase配置dataSource

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

在Spring Boot中为liquibase配置dataSource

这是将liquibase集成到Spring Boot中的简单步骤

步骤1

添加liquibase依赖

摇篮

runtime "org.liquibase:liquibase-core"

马文

<dependency>    <groupId>org.liquibase</groupId>    <artifactId>liquibase-core</artifactId>    <scope>runtime</scope></dependency>

第2步

在以下位置添加liquibase changelog文件路径

application.yml

liquibase:  enabled: true #this is optional as enabled by default  change-log: classpath:/liquibase/db-changelog.xml

通知物业

liquibase.change-log.
我指的路径
/liquibase/db-changelog.xml.

,所以你应该有一个文件名
db-changelog.xml
src/main/resources/liquibase/

步骤3

将更改集添加到文件上,并在启动Spring-Boot应用程序(

spring-boot:run
)时加载您的更改集。

这将使用

dataSource
您的应用程序使用的默认值。

更多信息:http : //docs.spring.io/spring-
boot/docs/1.4.3.RELEASE/reference/htmlsingle/#howto-execute-liquibase-
database-migrations-on-startup

更新资料

对于@veben在注释使用中指出的Spring Boot 2.0

spring:    liquibase:        change-log: #path


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/395457.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号