Skip to content

Commit faaada1

Browse files
committed
Remove liquibase check change log location
Missing change logs would lead to an exception even if the checkChangeLogLocation was set to false. Spring Boot's check would pass but Liquibase would fail later making this property redundant. Fixes gh-16232
1 parent eb26492 commit faaada1

File tree

4 files changed

+11
-27
lines changed

4 files changed

+11
-27
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import java.util.function.Supplier;
2020

21-
import javax.annotation.PostConstruct;
2221
import javax.persistence.EntityManagerFactory;
2322
import javax.sql.DataSource;
2423

@@ -43,13 +42,11 @@
4342
import org.springframework.context.annotation.Bean;
4443
import org.springframework.context.annotation.Configuration;
4544
import org.springframework.context.annotation.Import;
46-
import org.springframework.core.io.Resource;
4745
import org.springframework.core.io.ResourceLoader;
4846
import org.springframework.jdbc.core.JdbcOperations;
4947
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
5048
import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean;
5149
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
52-
import org.springframework.util.Assert;
5350

5451
/**
5552
* {@link EnableAutoConfiguration Auto-configuration} for Liquibase.
@@ -103,15 +100,6 @@ public LiquibaseConfiguration(LiquibaseProperties properties, DataSourceProperti
103100
this.liquibaseDataSource = liquibaseDataSource.getIfAvailable();
104101
}
105102

106-
@PostConstruct
107-
public void checkChangelogExists() {
108-
if (this.properties.isCheckChangeLogLocation()) {
109-
Resource resource = this.resourceLoader.getResource(this.properties.getChangeLog());
110-
Assert.state(resource.exists(), () -> "Cannot find changelog location: " + resource
111-
+ " (please add changelog or check your Liquibase " + "configuration)");
112-
}
113-
}
114-
115103
@Bean
116104
public SpringLiquibase liquibase() {
117105
SpringLiquibase liquibase = createSpringLiquibase();

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ public class LiquibaseProperties {
3838
*/
3939
private String changeLog = "classpath:/db/changelog/db.changelog-master.yaml";
4040

41-
/**
42-
* Whether to check that the change log location exists.
43-
*/
44-
private boolean checkChangeLogLocation = true;
45-
4641
/**
4742
* Comma-separated list of runtime contexts to use.
4843
*/
@@ -128,14 +123,6 @@ public void setChangeLog(String changeLog) {
128123
this.changeLog = changeLog;
129124
}
130125

131-
public boolean isCheckChangeLogLocation() {
132-
return this.checkChangeLogLocation;
133-
}
134-
135-
public void setCheckChangeLogLocation(boolean checkChangeLogLocation) {
136-
this.checkChangeLogLocation = checkChangeLogLocation;
137-
}
138-
139126
public String getContexts() {
140127
return this.contexts;
141128
}

spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@
976976
"description": "Check the change log location exists.",
977977
"defaultValue": true,
978978
"deprecation": {
979-
"replacement": "spring.liquibase.check-change-log-location",
979+
"reason": "Liquibase has it's own check that checks if the change log location exists making this property redundant.",
980980
"level": "error"
981981
}
982982
},
@@ -1875,6 +1875,16 @@
18751875
"level": "error"
18761876
}
18771877
},
1878+
{
1879+
"name": "spring.liquibase.check-change-log-location",
1880+
"type": "java.lang.Boolean",
1881+
"description": "Check the change log location exists.",
1882+
"defaultValue": true,
1883+
"deprecation": {
1884+
"reason": "Liquibase has it's own check that checks if the change log location exists making this property redundant.",
1885+
"level": "error"
1886+
}
1887+
},
18781888
{
18791889
"name": "spring.messages.cache-seconds",
18801890
"type": "java.lang.Integer",

spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,6 @@ content into your application. Rather, pick only the properties that you need.
592592
593593
# LIQUIBASE ({sc-spring-boot-autoconfigure}/liquibase/LiquibaseProperties.{sc-ext}[LiquibaseProperties])
594594
spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml # Change log configuration path.
595-
spring.liquibase.check-change-log-location=true # Whether to check that the change log location exists.
596595
spring.liquibase.contexts= # Comma-separated list of runtime contexts to use.
597596
spring.liquibase.database-change-log-lock-table=DATABASECHANGELOGLOCK # Name of table to use for tracking concurrent Liquibase usage.
598597
spring.liquibase.database-change-log-table=DATABASECHANGELOG # Name of table to use for tracking change history.

0 commit comments

Comments
 (0)