Drop 'spring' from 'spring.[liquibase,flyway]'
This commit is contained in:
parent
5548b24c4c
commit
2cd7b13096
|
|
@ -27,7 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.flyway", ignoreUnknownFields = false)
|
||||
@ConfigurationProperties(prefix = "flyway", ignoreUnknownFields = false)
|
||||
public class FlywayProperties {
|
||||
|
||||
private List<String> locations = Arrays.asList("db/migrations");
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||
*
|
||||
* @author Marcel Overdijk
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.liquibase", ignoreUnknownFields = false)
|
||||
@ConfigurationProperties(prefix = "liquibase", ignoreUnknownFields = false)
|
||||
public class LiquibaseProperties {
|
||||
|
||||
@NotNull
|
||||
private String changeLog = "classpath:/db/changelog/db.changelog-master.yaml";
|
||||
|
||||
private boolean checkChangeLogLocation = true;
|
||||
|
||||
|
||||
private String contexts;
|
||||
|
||||
private String defaultSchema;
|
||||
|
|
@ -44,7 +44,7 @@ public class LiquibaseProperties {
|
|||
private boolean shouldRun = true;
|
||||
|
||||
public String getChangeLog() {
|
||||
return changeLog;
|
||||
return this.changeLog;
|
||||
}
|
||||
|
||||
public void setChangeLog(String changeLog) {
|
||||
|
|
@ -52,7 +52,7 @@ public class LiquibaseProperties {
|
|||
}
|
||||
|
||||
public boolean isCheckChangeLogLocation() {
|
||||
return checkChangeLogLocation;
|
||||
return this.checkChangeLogLocation;
|
||||
}
|
||||
|
||||
public void setCheckChangeLogLocation(boolean checkChangeLogLocation) {
|
||||
|
|
@ -60,7 +60,7 @@ public class LiquibaseProperties {
|
|||
}
|
||||
|
||||
public String getContexts() {
|
||||
return contexts;
|
||||
return this.contexts;
|
||||
}
|
||||
|
||||
public void setContexts(String contexts) {
|
||||
|
|
@ -68,7 +68,7 @@ public class LiquibaseProperties {
|
|||
}
|
||||
|
||||
public String getDefaultSchema() {
|
||||
return defaultSchema;
|
||||
return this.defaultSchema;
|
||||
}
|
||||
|
||||
public void setDefaultSchema(String defaultSchema) {
|
||||
|
|
@ -76,7 +76,7 @@ public class LiquibaseProperties {
|
|||
}
|
||||
|
||||
public boolean isDropFirst() {
|
||||
return dropFirst;
|
||||
return this.dropFirst;
|
||||
}
|
||||
|
||||
public void setDropFirst(boolean dropFirst) {
|
||||
|
|
@ -84,7 +84,7 @@ public class LiquibaseProperties {
|
|||
}
|
||||
|
||||
public boolean isShouldRun() {
|
||||
return shouldRun;
|
||||
return this.shouldRun;
|
||||
}
|
||||
|
||||
public void setShouldRun(boolean shouldRun) {
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class FlywayAutoConfigurationTests {
|
|||
@Test
|
||||
public void testOverrideLocations() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.flyway.locations:classpath:db/changelog");
|
||||
"flyway.locations:classpath:db/changelog");
|
||||
this.context
|
||||
.register(EmbeddedDataSourceConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
|
|
@ -90,7 +90,7 @@ public class FlywayAutoConfigurationTests {
|
|||
|
||||
@Test
|
||||
public void testOverrideSchemas() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.flyway.schemas:public");
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "flyway.schemas:public");
|
||||
this.context
|
||||
.register(EmbeddedDataSourceConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
|
|
@ -102,8 +102,7 @@ public class FlywayAutoConfigurationTests {
|
|||
|
||||
@Test(expected = BeanCreationException.class)
|
||||
public void testChangeLogDoesNotExist() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.flyway.locations:no-such-dir");
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "flyway.locations:no-such-dir");
|
||||
this.context
|
||||
.register(EmbeddedDataSourceConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
|
|
|
|||
|
|
@ -69,7 +69,8 @@ public class LiquibaseAutoConfigurationTests {
|
|||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class);
|
||||
assertEquals("classpath:/db/changelog/db.changelog-master.yaml", liquibase.getChangeLog());
|
||||
assertEquals("classpath:/db/changelog/db.changelog-master.yaml",
|
||||
liquibase.getChangeLog());
|
||||
assertNull(liquibase.getContexts());
|
||||
assertNull(liquibase.getDefaultSchema());
|
||||
assertFalse(liquibase.isDropFirst());
|
||||
|
|
@ -78,19 +79,20 @@ public class LiquibaseAutoConfigurationTests {
|
|||
@Test
|
||||
public void testOverrideChangeLog() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.liquibase.change-log:classpath:/db/changelog/db.changelog-override.xml");
|
||||
"liquibase.change-log:classpath:/db/changelog/db.changelog-override.xml");
|
||||
this.context.register(EmbeddedDataSourceConfiguration.class,
|
||||
LiquibaseAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class);
|
||||
assertEquals("classpath:/db/changelog/db.changelog-override.xml", liquibase.getChangeLog());
|
||||
assertEquals("classpath:/db/changelog/db.changelog-override.xml",
|
||||
liquibase.getChangeLog());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverrideContexts() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.liquibase.contexts:test, production");
|
||||
"liquibase.contexts:test, production");
|
||||
this.context.register(EmbeddedDataSourceConfiguration.class,
|
||||
LiquibaseAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
|
|
@ -98,11 +100,11 @@ public class LiquibaseAutoConfigurationTests {
|
|||
SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class);
|
||||
assertEquals("test, production", liquibase.getContexts());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testOverrideDefaultSchema() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.liquibase.default-schema:public");
|
||||
"liquibase.default-schema:public");
|
||||
this.context.register(EmbeddedDataSourceConfiguration.class,
|
||||
LiquibaseAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
|
|
@ -110,11 +112,10 @@ public class LiquibaseAutoConfigurationTests {
|
|||
SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class);
|
||||
assertEquals("public", liquibase.getDefaultSchema());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testOverrideDropFirst() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.liquibase.drop-first:true");
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "liquibase.drop-first:true");
|
||||
this.context.register(EmbeddedDataSourceConfiguration.class,
|
||||
LiquibaseAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
|
|
@ -122,11 +123,11 @@ public class LiquibaseAutoConfigurationTests {
|
|||
SpringLiquibase liquibase = this.context.getBean(SpringLiquibase.class);
|
||||
assertTrue(liquibase.isDropFirst());
|
||||
}
|
||||
|
||||
|
||||
@Test(expected = BeanCreationException.class)
|
||||
public void testChangeLogDoesNotExist() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.liquibase.change-log:classpath:/no-such-changelog.yaml");
|
||||
"liquibase.change-log:classpath:/no-such-changelog.yaml");
|
||||
this.context.register(EmbeddedDataSourceConfiguration.class,
|
||||
LiquibaseAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
|
|
|
|||
|
|
@ -158,12 +158,19 @@ content into your application; rather pick only the properties that you need.
|
|||
spring.jpa.hibernate.naming-strategy= # naming classname
|
||||
spring.jpa.hibernate.ddl-auto= # defaults to create-drop for embedded dbs
|
||||
|
||||
# FLYWAY ({sc-spring-boot-autoconfigure}/flyway/FlywayProperties.{sc-ext}[FlywayProperties])
|
||||
flyway.change-log=classpath:/db/changelog/db.changelog-master.yaml
|
||||
flyway.contexts= # runtime contexts to use
|
||||
flyway.default-schema= # default database schema to use
|
||||
flyway.drop-first=false
|
||||
flyway.should-run=true
|
||||
|
||||
# LIQUIBASE ({sc-spring-boot-autoconfigure}/liquibase/LiquibaseProperties.{sc-ext}[LiquibaseProperties])
|
||||
spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml
|
||||
spring.liquibase.contexts= # runtime contexts to use
|
||||
spring.liquibase.default-schema= # default database schema to use
|
||||
spring.liquibase.drop-first=false
|
||||
spring.liquibase.should-run=true
|
||||
liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml
|
||||
liquibase.contexts= # runtime contexts to use
|
||||
liquibase.default-schema= # default database schema to use
|
||||
liquibase.drop-first=false
|
||||
liquibase.should-run=true
|
||||
|
||||
# JMX
|
||||
spring.jmx.enabled=true # Expose MBeans from Spring
|
||||
|
|
|
|||
|
|
@ -1117,7 +1117,7 @@ To automatically run Liquibase database migrations on startup, add the
|
|||
`spring-boot-starter-liquibase` to your classpath.
|
||||
|
||||
The master change log is by default read from `db/changelog/db.changelog-master.yaml` but
|
||||
can be set using `spring.liquibase.change-log`. See
|
||||
can be set using `liquibase.change-log`. See
|
||||
{sc-spring-boot-autoconfigure}/liquibase/LiquibaseProperties.{sc-ext}[`LiquibaseProperties`]
|
||||
for details of available settings like contexts, default schema etc.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue