【视频&交流平台】
à Spring Boot视频
http://study.163.com/course/introduction.htm?courseId=1004329008&utm_campaign=commission&utm_source=400000000155061&utm_medium=share
à Spring Cloud视频
http://study.163.com/course/introduction.htm?courseId=1004638001&utm_campaign=commission&utm_source=400000000155061&utm_medium=share
à Spring Boot源码
https://gitee.com/happyangellxq520/spring-boot
à Spring Boot交流平台
http://412887952-qq-com.iteye.com/blog/2321532
【最新动态】
《Spring Cloud视频》更新最新章节:
Spring Cloud Hystrix进阶之断路器Hystrix总结
说明:
(1)Spring Boot 版本:2.0.0.RELEASE
(2)Liquibase版本:3.5.5
前言:
在上一节中spring boot使用了1.5.12.RELEASE,这里我们要看看2.0.0.RELEASE的一个使用情况。大体的思路和上一篇是使用的,这里我们在上一篇文章的基础上进行调整。
一、版本说明
这里的Spring Boot版本使用的是2.0.0.RELEASE,Liquibase这里还是3.5.5的版本的。
二、准备工作
在上一篇的基础上,我们首先要修改下配置文件application.properties,因为在2.0.0配置路径的配置项修改了,如下配置:
spring.liquibase.change-log= classpath:/db/changelog/db.changelog-master.sql
当1.5.12版本是如下配置:
liquibase.change-log= classpath:/db/changelog/db.changelog-master.sql
这里由于Liquibase的版本还是3.5.5版本的,所以不需要数据库的表结构信息就可以测试了。
三、测试
到这里就可以运行测试了,顺利的话, 一切就会如之前一样的效果了。
四、配置说明
对于2.x的版本,Liquibase的配置加上了spring的前缀,如下配置:
# LIQUIBASE (LiquibaseProperties)
spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml # Change log configuration path.
spring.liquibase.check-change-log-location=true # Whether to check that the change log location exists.
spring.liquibase.contexts= # Comma-separated list of runtime contexts to use.
spring.liquibase.default-schema= # Default database schema.
spring.liquibase.drop-first=false # Whether to first drop the database schema.
spring.liquibase.enabled=true # Whether to enable Liquibase support.
spring.liquibase.labels= # Comma-separated list of runtime labels to use.
spring.liquibase.parameters.*= # Change log parameters.
spring.liquibase.password= # Login password of the database to migrate.
spring.liquibase.rollback-file= # File to which rollback SQL is written when an update is performed.
spring.liquibase.url= # JDBC URL of the database to migrate. If not set, the primary configured data source is used.
spring.liquibase.user= # Login user of the database to migrate.
Spring Boot 1.x的版本的配置如下:
# LIQUIBASE (LiquibaseProperties)
liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml # Change log configuration path.
liquibase.check-change-log-location=true # Check the change log location exists.
liquibase.contexts= # Comma-separated list of runtime contexts to use.
liquibase.default-schema= # Default database schema.
liquibase.drop-first=false # Drop the database schema first.
liquibase.enabled=true # Enable liquibase support.
liquibase.labels= # Comma-separated list of runtime labels to use.
liquibase.parameters.*= # Change log parameters.
liquibase.password= # Login password of the database to migrate.
liquibase.rollback-file= # File to which rollback SQL will be written when an update is performed.
liquibase.url= # JDBC url of the database to migrate. If not set, the primary configured data source is used.
liquibase.user= # Login user of the database to migrate.