Move Flyway config properties to spring.flyway
Closes gh-9896
This commit is contained in:
		
							parent
							
								
									7cc4410613
								
							
						
					
					
						commit
						f9e316306a
					
				|  | @ -50,7 +50,7 @@ public class SpringApplicationHierarchyTests { | ||||||
| 	@Test | 	@Test | ||||||
| 	public void testParent() { | 	public void testParent() { | ||||||
| 		SpringApplicationBuilder builder = new SpringApplicationBuilder(Child.class); | 		SpringApplicationBuilder builder = new SpringApplicationBuilder(Child.class); | ||||||
| 		builder.properties("flyway.enabled=false", "liquibase.enabled=false"); | 		builder.properties("spring.flyway.enabled=false", "liquibase.enabled=false"); | ||||||
| 		builder.parent(Parent.class); | 		builder.parent(Parent.class); | ||||||
| 		this.context = builder.run("--server.port=0"); | 		this.context = builder.run("--server.port=0"); | ||||||
| 	} | 	} | ||||||
|  | @ -58,7 +58,7 @@ public class SpringApplicationHierarchyTests { | ||||||
| 	@Test | 	@Test | ||||||
| 	public void testChild() { | 	public void testChild() { | ||||||
| 		SpringApplicationBuilder builder = new SpringApplicationBuilder(Parent.class); | 		SpringApplicationBuilder builder = new SpringApplicationBuilder(Parent.class); | ||||||
| 		builder.properties("flyway.enabled=false", "liquibase.enabled=false"); | 		builder.properties("spring.flyway.enabled=false", "liquibase.enabled=false"); | ||||||
| 		builder.child(Child.class); | 		builder.child(Child.class); | ||||||
| 		this.context = builder.run("--server.port=0"); | 		this.context = builder.run("--server.port=0"); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -69,7 +69,7 @@ import org.springframework.util.ObjectUtils; | ||||||
| @Configuration | @Configuration | ||||||
| @ConditionalOnClass(Flyway.class) | @ConditionalOnClass(Flyway.class) | ||||||
| @ConditionalOnBean(DataSource.class) | @ConditionalOnBean(DataSource.class) | ||||||
| @ConditionalOnProperty(prefix = "flyway", name = "enabled", matchIfMissing = true) | @ConditionalOnProperty(prefix = "spring.flyway", name = "enabled", matchIfMissing = true) | ||||||
| @AutoConfigureAfter({ DataSourceAutoConfiguration.class, | @AutoConfigureAfter({ DataSourceAutoConfiguration.class, | ||||||
| 		HibernateJpaAutoConfiguration.class }) | 		HibernateJpaAutoConfiguration.class }) | ||||||
| public class FlywayAutoConfiguration { | public class FlywayAutoConfiguration { | ||||||
|  | @ -133,7 +133,7 @@ public class FlywayAutoConfiguration { | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		@Bean | 		@Bean | ||||||
| 		@ConfigurationProperties(prefix = "flyway") | 		@ConfigurationProperties(prefix = "spring.flyway") | ||||||
| 		public Flyway flyway() { | 		public Flyway flyway() { | ||||||
| 			Flyway flyway = new SpringBootFlyway(); | 			Flyway flyway = new SpringBootFlyway(); | ||||||
| 			if (this.properties.isCreateDataSource()) { | 			if (this.properties.isCreateDataSource()) { | ||||||
|  |  | ||||||
|  | @ -33,7 +33,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; | ||||||
|  * @author Dave Syer |  * @author Dave Syer | ||||||
|  * @since 1.1.0 |  * @since 1.1.0 | ||||||
|  */ |  */ | ||||||
| @ConfigurationProperties(prefix = "flyway", ignoreUnknownFields = true) | @ConfigurationProperties(prefix = "spring.flyway", ignoreUnknownFields = true) | ||||||
| public class FlywayProperties { | public class FlywayProperties { | ||||||
| 
 | 
 | ||||||
| 	/** | 	/** | ||||||
|  |  | ||||||
|  | @ -95,7 +95,7 @@ public class FlywayAutoConfigurationTests { | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	public void createDataSource() throws Exception { | 	public void createDataSource() throws Exception { | ||||||
| 		TestPropertyValues.of("flyway.url:jdbc:hsqldb:mem:flywaytest", "flyway.user:sa") | 		TestPropertyValues.of("spring.flyway.url:jdbc:hsqldb:mem:flywaytest", "spring.flyway.user:sa") | ||||||
| 				.applyTo(this.context); | 				.applyTo(this.context); | ||||||
| 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | ||||||
| 				FlywayAutoConfiguration.class, | 				FlywayAutoConfiguration.class, | ||||||
|  | @ -126,7 +126,7 @@ public class FlywayAutoConfigurationTests { | ||||||
| 	@Test | 	@Test | ||||||
| 	public void overrideLocations() throws Exception { | 	public void overrideLocations() throws Exception { | ||||||
| 		TestPropertyValues | 		TestPropertyValues | ||||||
| 				.of("flyway.locations:classpath:db/changelog,classpath:db/migration") | 				.of("spring.flyway.locations:classpath:db/changelog,classpath:db/migration") | ||||||
| 				.applyTo(this.context); | 				.applyTo(this.context); | ||||||
| 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | ||||||
| 				FlywayAutoConfiguration.class, | 				FlywayAutoConfiguration.class, | ||||||
|  | @ -139,8 +139,8 @@ public class FlywayAutoConfigurationTests { | ||||||
| 	@Test | 	@Test | ||||||
| 	public void overrideLocationsList() throws Exception { | 	public void overrideLocationsList() throws Exception { | ||||||
| 		TestPropertyValues | 		TestPropertyValues | ||||||
| 				.of("flyway.locations[0]:classpath:db/changelog", | 				.of("spring.flyway.locations[0]:classpath:db/changelog", | ||||||
| 						"flyway.locations[1]:classpath:db/migration") | 						"spring.flyway.locations[1]:classpath:db/migration") | ||||||
| 				.applyTo(this.context); | 				.applyTo(this.context); | ||||||
| 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | ||||||
| 				FlywayAutoConfiguration.class, | 				FlywayAutoConfiguration.class, | ||||||
|  | @ -152,7 +152,7 @@ public class FlywayAutoConfigurationTests { | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	public void overrideSchemas() throws Exception { | 	public void overrideSchemas() throws Exception { | ||||||
| 		TestPropertyValues.of("flyway.schemas:public").applyTo(this.context); | 		TestPropertyValues.of("spring.flyway.schemas:public").applyTo(this.context); | ||||||
| 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | ||||||
| 				FlywayAutoConfiguration.class, | 				FlywayAutoConfiguration.class, | ||||||
| 				PropertyPlaceholderAutoConfiguration.class); | 				PropertyPlaceholderAutoConfiguration.class); | ||||||
|  | @ -162,7 +162,7 @@ public class FlywayAutoConfigurationTests { | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	public void changeLogDoesNotExist() throws Exception { | 	public void changeLogDoesNotExist() throws Exception { | ||||||
| 		TestPropertyValues.of("flyway.locations:file:no-such-dir").applyTo(this.context); | 		TestPropertyValues.of("spring.flyway.locations:file:no-such-dir").applyTo(this.context); | ||||||
| 		this.thrown.expect(BeanCreationException.class); | 		this.thrown.expect(BeanCreationException.class); | ||||||
| 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | ||||||
| 				FlywayAutoConfiguration.class, | 				FlywayAutoConfiguration.class, | ||||||
|  | @ -172,8 +172,8 @@ public class FlywayAutoConfigurationTests { | ||||||
| 	@Test | 	@Test | ||||||
| 	public void checkLocationsAllMissing() throws Exception { | 	public void checkLocationsAllMissing() throws Exception { | ||||||
| 		TestPropertyValues | 		TestPropertyValues | ||||||
| 				.of("flyway.locations:classpath:db/missing1,classpath:db/migration2", | 				.of("spring.flyway.locations:classpath:db/missing1,classpath:db/migration2", | ||||||
| 						"flyway.check-location:true") | 						"spring.flyway.check-location:true") | ||||||
| 				.applyTo(this.context); | 				.applyTo(this.context); | ||||||
| 		this.thrown.expect(BeanCreationException.class); | 		this.thrown.expect(BeanCreationException.class); | ||||||
| 		this.thrown.expectMessage("Cannot find migrations location in"); | 		this.thrown.expectMessage("Cannot find migrations location in"); | ||||||
|  | @ -185,8 +185,8 @@ public class FlywayAutoConfigurationTests { | ||||||
| 	@Test | 	@Test | ||||||
| 	public void checkLocationsAllExist() throws Exception { | 	public void checkLocationsAllExist() throws Exception { | ||||||
| 		TestPropertyValues | 		TestPropertyValues | ||||||
| 				.of("flyway.locations:classpath:db/changelog,classpath:db/migration", | 				.of("spring.flyway.locations:classpath:db/changelog,classpath:db/migration", | ||||||
| 						"flyway.check-location:true") | 						"spring.flyway.check-location:true") | ||||||
| 				.applyTo(this.context); | 				.applyTo(this.context); | ||||||
| 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | ||||||
| 				FlywayAutoConfiguration.class, | 				FlywayAutoConfiguration.class, | ||||||
|  | @ -222,7 +222,7 @@ public class FlywayAutoConfigurationTests { | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	public void overrideBaselineVersionString() throws Exception { | 	public void overrideBaselineVersionString() throws Exception { | ||||||
| 		TestPropertyValues.of("flyway.baseline-version=0").applyTo(this.context); | 		TestPropertyValues.of("spring.flyway.baseline-version=0").applyTo(this.context); | ||||||
| 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | ||||||
| 				FlywayAutoConfiguration.class, | 				FlywayAutoConfiguration.class, | ||||||
| 				PropertyPlaceholderAutoConfiguration.class); | 				PropertyPlaceholderAutoConfiguration.class); | ||||||
|  | @ -234,7 +234,7 @@ public class FlywayAutoConfigurationTests { | ||||||
| 	@Test | 	@Test | ||||||
| 	public void overrideBaselineVersionNumber() throws Exception { | 	public void overrideBaselineVersionNumber() throws Exception { | ||||||
| 		Map<String, Object> source = Collections | 		Map<String, Object> source = Collections | ||||||
| 				.<String, Object>singletonMap("flyway.baseline-version", 1); | 				.<String, Object>singletonMap("spring.flyway.baseline-version", 1); | ||||||
| 		this.context.getEnvironment().getPropertySources() | 		this.context.getEnvironment().getPropertySources() | ||||||
| 				.addLast(new MapPropertySource("flyway", source)); | 				.addLast(new MapPropertySource("flyway", source)); | ||||||
| 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | ||||||
|  | @ -248,7 +248,7 @@ public class FlywayAutoConfigurationTests { | ||||||
| 	@Test | 	@Test | ||||||
| 	public void useVendorDirectory() throws Exception { | 	public void useVendorDirectory() throws Exception { | ||||||
| 		TestPropertyValues | 		TestPropertyValues | ||||||
| 				.of("flyway.locations=classpath:db/vendors/{vendor},classpath:db/changelog") | 				.of("spring.flyway.locations=classpath:db/vendors/{vendor},classpath:db/changelog") | ||||||
| 				.applyTo(this.context); | 				.applyTo(this.context); | ||||||
| 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | 		registerAndRefresh(EmbeddedDataSourceConfiguration.class, | ||||||
| 				FlywayAutoConfiguration.class, | 				FlywayAutoConfiguration.class, | ||||||
|  |  | ||||||
|  | @ -105,7 +105,7 @@ public class HibernateJpaAutoConfigurationTests | ||||||
| 	public void testFlywayPlusValidation() throws Exception { | 	public void testFlywayPlusValidation() throws Exception { | ||||||
| 		load(new Class<?>[0], new Class<?>[] { FlywayAutoConfiguration.class }, | 		load(new Class<?>[0], new Class<?>[] { FlywayAutoConfiguration.class }, | ||||||
| 				"spring.datasource.initialize:false", | 				"spring.datasource.initialize:false", | ||||||
| 				"flyway.locations:classpath:db/city", | 				"spring.flyway.locations:classpath:db/city", | ||||||
| 				"spring.jpa.hibernate.ddl-auto:validate"); | 				"spring.jpa.hibernate.ddl-auto:validate"); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -516,39 +516,39 @@ content into your application; rather pick only the properties that you need. | ||||||
| 	# ---------------------------------------- | 	# ---------------------------------------- | ||||||
| 
 | 
 | ||||||
| 	# FLYWAY ({sc-spring-boot-autoconfigure}/flyway/FlywayProperties.{sc-ext}[FlywayProperties]) | 	# FLYWAY ({sc-spring-boot-autoconfigure}/flyway/FlywayProperties.{sc-ext}[FlywayProperties]) | ||||||
| 	flyway.allow-mixed-migrations= # | 	spring.flyway.allow-mixed-migrations= # | ||||||
| 	flyway.baseline-description= # | 	spring.flyway.baseline-description= # | ||||||
| 	flyway.baseline-on-migrate= # | 	spring.flyway.baseline-on-migrate= # | ||||||
| 	flyway.baseline-version=1 # version to start migration | 	spring.flyway.baseline-version=1 # version to start migration | ||||||
| 	flyway.check-location=false # Check that migration scripts location exists. | 	spring.flyway.check-location=false # Check that migration scripts location exists. | ||||||
| 	flyway.clean-disabled= # | 	spring.flyway.clean-disabled= # | ||||||
| 	flyway.clean-on-validation-error= # | 	spring.flyway.clean-on-validation-error= # | ||||||
| 	flyway.enabled=true # Enable flyway. | 	spring.flyway.enabled=true # Enable flyway. | ||||||
| 	flyway.encoding= # | 	spring.flyway.encoding= # | ||||||
| 	flyway.ignore-failed-future-migration= # | 	spring.flyway.ignore-failed-future-migration= # | ||||||
| 	flyway.ignore-future-migrations= # | 	spring.flyway.ignore-future-migrations= # | ||||||
| 	flyway.ignore-missing-migrations= # | 	spring.flyway.ignore-missing-migrations= # | ||||||
| 	flyway.init-sqls= # SQL statements to execute to initialize a connection immediately after obtaining it. | 	spring.flyway.init-sqls= # SQL statements to execute to initialize a connection immediately after obtaining it. | ||||||
| 	flyway.installed-by= # | 	spring.flyway.installed-by= # | ||||||
| 	flyway.locations=classpath:db/migration # locations of migrations scripts | 	spring.flyway.locations=classpath:db/migration # locations of migrations scripts | ||||||
| 	flyway.out-of-order= # | 	spring.flyway.out-of-order= # | ||||||
| 	flyway.password= # JDBC password if you want Flyway to create its own DataSource | 	spring.flyway.password= # JDBC password if you want Flyway to create its own DataSource | ||||||
| 	flyway.placeholder-prefix= # | 	spring.flyway.placeholder-prefix= # | ||||||
| 	flyway.placeholder-replacement= # | 	spring.flyway.placeholder-replacement= # | ||||||
| 	flyway.placeholder-suffix= # | 	spring.flyway.placeholder-suffix= # | ||||||
| 	flyway.placeholders.*= # | 	spring.flyway.placeholders.*= # | ||||||
| 	flyway.repeatable-sql-migration-prefix= # | 	spring.flyway.repeatable-sql-migration-prefix= # | ||||||
| 	flyway.schemas= # schemas to update | 	spring.flyway.schemas= # schemas to update | ||||||
| 	flyway.skip-default-callbacks= # | 	spring.flyway.skip-default-callbacks= # | ||||||
| 	flyway.skip-default-resolvers= # | 	spring.flyway.skip-default-resolvers= # | ||||||
| 	flyway.sql-migration-prefix=V # | 	spring.flyway.sql-migration-prefix=V # | ||||||
| 	flyway.sql-migration-separator= # | 	spring.flyway.sql-migration-separator= # | ||||||
| 	flyway.sql-migration-suffix=.sql # | 	spring.flyway.sql-migration-suffix=.sql # | ||||||
| 	flyway.table= # | 	spring.flyway.table= # | ||||||
| 	flyway.target= # | 	spring.flyway.target= # | ||||||
| 	flyway.url= # JDBC url of the database to migrate. If not set, the primary configured data source is used. | 	spring.flyway.url= # JDBC url of the database to migrate. If not set, the primary configured data source is used. | ||||||
| 	flyway.user= # Login user of the database to migrate. | 	spring.flyway.user= # Login user of the database to migrate. | ||||||
| 	flyway.validate-on-migrate= # | 	spring.flyway.validate-on-migrate= # | ||||||
| 
 | 
 | ||||||
| 	# LIQUIBASE ({sc-spring-boot-autoconfigure}/liquibase/LiquibaseProperties.{sc-ext}[LiquibaseProperties]) | 	# LIQUIBASE ({sc-spring-boot-autoconfigure}/liquibase/LiquibaseProperties.{sc-ext}[LiquibaseProperties]) | ||||||
| 	liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml # Change log configuration path. | 	liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml # Change log configuration path. | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue