|
|
|
@ -25,6 +25,7 @@ import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty; |
|
|
|
import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty; |
|
|
|
|
|
|
|
import org.springframework.boot.configurationmetadata.Deprecation; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -74,10 +75,7 @@ class PropertiesMigrationReport { |
|
|
|
StringBuilder report = new StringBuilder(); |
|
|
|
StringBuilder report = new StringBuilder(); |
|
|
|
report.append(String.format("%nThe use of configuration keys that are no longer " |
|
|
|
report.append(String.format("%nThe use of configuration keys that are no longer " |
|
|
|
+ "supported was found in the environment:%n%n")); |
|
|
|
+ "supported was found in the environment:%n%n")); |
|
|
|
append(report, content, |
|
|
|
append(report, content, this::determineReason); |
|
|
|
(metadata) -> "Reason: " |
|
|
|
|
|
|
|
+ (StringUtils.hasText(metadata.getDeprecation().getShortReason()) |
|
|
|
|
|
|
|
? metadata.getDeprecation().getShortReason() : "none")); |
|
|
|
|
|
|
|
report.append(String.format("%n")); |
|
|
|
report.append(String.format("%n")); |
|
|
|
report.append("Please refer to the migration guide or reference guide for " |
|
|
|
report.append("Please refer to the migration guide or reference guide for " |
|
|
|
+ "potential alternatives."); |
|
|
|
+ "potential alternatives."); |
|
|
|
@ -85,6 +83,18 @@ class PropertiesMigrationReport { |
|
|
|
return report.toString(); |
|
|
|
return report.toString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String determineReason(ConfigurationMetadataProperty metadata) { |
|
|
|
|
|
|
|
Deprecation deprecation = metadata.getDeprecation(); |
|
|
|
|
|
|
|
if (StringUtils.hasText(deprecation.getShortReason())) { |
|
|
|
|
|
|
|
return deprecation.getShortReason(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.hasText(deprecation.getReplacement())) { |
|
|
|
|
|
|
|
return String.format("Reason: Replacement key '%s' uses an incompatible " |
|
|
|
|
|
|
|
+ "target type", deprecation.getReplacement()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return "none"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Map<String, List<PropertyMigration>> getContent( |
|
|
|
private Map<String, List<PropertyMigration>> getContent( |
|
|
|
Function<LegacyProperties, List<PropertyMigration>> extractor) { |
|
|
|
Function<LegacyProperties, List<PropertyMigration>> extractor) { |
|
|
|
return this.content.entrySet().stream() |
|
|
|
return this.content.entrySet().stream() |
|
|
|
|