commit
ea244aa32b
|
@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.liquibase;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
@ -46,13 +45,11 @@ import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Conditional;
|
import org.springframework.context.annotation.Conditional;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.core.io.Resource;
|
|
||||||
import org.springframework.core.io.ResourceLoader;
|
import org.springframework.core.io.ResourceLoader;
|
||||||
import org.springframework.jdbc.core.JdbcOperations;
|
import org.springframework.jdbc.core.JdbcOperations;
|
||||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
|
||||||
import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean;
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
import org.springframework.util.Assert;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link EnableAutoConfiguration Auto-configuration} for Liquibase.
|
* {@link EnableAutoConfiguration Auto-configuration} for Liquibase.
|
||||||
|
@ -95,15 +92,6 @@ public class LiquibaseAutoConfiguration {
|
||||||
this.resourceLoader = resourceLoader;
|
this.resourceLoader = resourceLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void checkChangelogExists() {
|
|
||||||
if (this.properties.isCheckChangeLogLocation()) {
|
|
||||||
Resource resource = this.resourceLoader.getResource(this.properties.getChangeLog());
|
|
||||||
Assert.state(resource.exists(), () -> "Cannot find changelog location: " + resource
|
|
||||||
+ " (please add changelog or check your Liquibase configuration)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SpringLiquibase liquibase(DataSourceProperties dataSourceProperties,
|
public SpringLiquibase liquibase(DataSourceProperties dataSourceProperties,
|
||||||
ObjectProvider<DataSource> dataSource,
|
ObjectProvider<DataSource> dataSource,
|
||||||
|
|
|
@ -38,11 +38,6 @@ public class LiquibaseProperties {
|
||||||
*/
|
*/
|
||||||
private String changeLog = "classpath:/db/changelog/db.changelog-master.yaml";
|
private String changeLog = "classpath:/db/changelog/db.changelog-master.yaml";
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether to check that the change log location exists.
|
|
||||||
*/
|
|
||||||
private boolean checkChangeLogLocation = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comma-separated list of runtime contexts to use.
|
* Comma-separated list of runtime contexts to use.
|
||||||
*/
|
*/
|
||||||
|
@ -128,14 +123,6 @@ public class LiquibaseProperties {
|
||||||
this.changeLog = changeLog;
|
this.changeLog = changeLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCheckChangeLogLocation() {
|
|
||||||
return this.checkChangeLogLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCheckChangeLogLocation(boolean checkChangeLogLocation) {
|
|
||||||
this.checkChangeLogLocation = checkChangeLogLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContexts() {
|
public String getContexts() {
|
||||||
return this.contexts;
|
return this.contexts;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1054,7 +1054,7 @@
|
||||||
"description": "Check the change log location exists.",
|
"description": "Check the change log location exists.",
|
||||||
"defaultValue": true,
|
"defaultValue": true,
|
||||||
"deprecation": {
|
"deprecation": {
|
||||||
"replacement": "spring.liquibase.check-change-log-location",
|
"reason": "Liquibase has it's own check that checks if the change log location exists making this property redundant.",
|
||||||
"level": "error"
|
"level": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1963,6 +1963,16 @@
|
||||||
"level": "error"
|
"level": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "spring.liquibase.check-change-log-location",
|
||||||
|
"type": "java.lang.Boolean",
|
||||||
|
"description": "Check the change log location exists.",
|
||||||
|
"defaultValue": true,
|
||||||
|
"deprecation": {
|
||||||
|
"reason": "Liquibase has it's own check that checks if the change log location exists making this property redundant.",
|
||||||
|
"level": "error"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "spring.messages.cache-seconds",
|
"name": "spring.messages.cache-seconds",
|
||||||
"type": "java.lang.Integer",
|
"type": "java.lang.Integer",
|
||||||
|
|
Loading…
Reference in New Issue