diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java index 2d165d52fe..f030a46915 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java @@ -112,6 +112,7 @@ public class LiquibaseAutoConfiguration { liquibase.setChangeLogParameters(this.properties.getParameters()); liquibase.setRollbackFile(this.properties.getRollbackFile()); liquibase.setTestRollbackOnUpdate(this.properties.isTestRollbackOnUpdate()); + liquibase.setTag(this.properties.getTag()); return liquibase; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java index 7cce05c042..b3bbbd80da 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java @@ -28,6 +28,7 @@ import org.springframework.util.Assert; * Configuration properties to configure {@link SpringLiquibase}. * * @author Marcel Overdijk + * @author EddĂș MelĂ©ndez * @since 1.1.0 */ @ConfigurationProperties(prefix = "spring.liquibase", ignoreUnknownFields = false) @@ -114,6 +115,11 @@ public class LiquibaseProperties { */ private boolean testRollbackOnUpdate; + /** + * Name of the tag. + */ + private String tag; + public String getChangeLog() { return this.changeLog; } @@ -243,4 +249,12 @@ public class LiquibaseProperties { this.testRollbackOnUpdate = testRollbackOnUpdate; } + public String getTag() { + return this.tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java index 04398c3a9e..93b255d870 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java @@ -343,6 +343,13 @@ class LiquibaseAutoConfigurationTests { }); } + @Test + void overrideTag() { + this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) + .withPropertyValues("spring.liquibase.tag:1.0.0") + .run(assertLiquibase((liquibase) -> assertThat(liquibase.getTag()).isEqualTo("1.0.0"))); + } + private ContextConsumer assertLiquibase(Consumer consumer) { return (context) -> { assertThat(context).hasSingleBean(SpringLiquibase.class);