这是将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



