From 2577c671857d5478bbfcbe7168b9f85415d56b3a Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 13 Oct 2020 13:17:49 +0200 Subject: [PATCH] Fix mapping of outputQueryResults property Closes gh-23645 --- .../autoconfigure/flyway/FlywayAutoConfiguration.java | 3 +++ .../boot/autoconfigure/flyway/FlywayProperties.java | 6 +++--- .../flyway/FlywayAutoConfigurationTests.java | 11 +++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java index cd866b11b9..fe146eed9a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java @@ -233,6 +233,9 @@ public class FlywayAutoConfiguration { map.from(properties.getOracleKerberosConfigFile()).whenNonNull() .to((configFile) -> configuration.orackeKerberosConfigFile(configFile)); // No method reference for compatibility with Flyway 6.x + map.from(properties.getOutputQueryResults()).whenNonNull() + .to((outputQueryResults) -> configuration.outputQueryResults(outputQueryResults)); + // No method reference for compatibility with Flyway 6.x map.from(properties.getSkipExecutingMigrations()).whenNonNull() .to((skipExecutingMigrations) -> configuration.skipExecutingMigrations(skipExecutingMigrations)); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java index d62b7e2a6b..d575a973cb 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java @@ -315,7 +315,7 @@ public class FlywayProperties { * Whether Flyway should output a table with the results of queries when executing * migrations. Requires Flyway Teams. */ - private boolean outputQueryResults = true; + private Boolean outputQueryResults; /** * Whether Flyway should skip executing the contents of the migrations and only update @@ -743,11 +743,11 @@ public class FlywayProperties { this.oracleKerberosConfigFile = oracleKerberosConfigFile; } - public boolean isOutputQueryResults() { + public Boolean getOutputQueryResults() { return this.outputQueryResults; } - public void setOutputQueryResults(boolean outputQueryResults) { + public void setOutputQueryResults(Boolean outputQueryResults) { this.outputQueryResults = outputQueryResults; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java index a5432ae070..78be54d7a8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java @@ -563,6 +563,17 @@ class FlywayAutoConfigurationTests { }); } + @Test + void outputQueryResultsIsCorrectlyMapped() { + this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) + .withPropertyValues("spring.flyway.output-query-results=false").run((context) -> { + assertThat(context).hasFailed(); + Throwable failure = context.getStartupFailure(); + assertThat(failure).hasRootCauseInstanceOf(FlywayTeamsUpgradeRequiredException.class); + assertThat(failure).hasMessageContaining(" outputQueryResults "); + }); + } + @Test void skipExecutingMigrationsIsCorrectlyMapped() { this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)