Include all deprecated properties in migration report

This commit expands the migration check to all deprecated properties,
not only the ones that have been effectively removed. This provides more
information upfront, including keys that still work in the current
release but will need to be renamed sooner than later anyway.

Closes gh-21425
pull/21440/head
Stephane Nicoll 5 years ago
parent 786dae5d9a
commit f43419054d

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,7 +25,6 @@ import java.util.stream.Collectors;
import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
import org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository;
import org.springframework.boot.configurationmetadata.Deprecation;
import org.springframework.boot.context.properties.source.ConfigurationProperty;
import org.springframework.boot.context.properties.source.ConfigurationPropertyName;
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
@ -62,7 +61,8 @@ class PropertiesMigrationReporter {
*/
PropertiesMigrationReport getReport() {
PropertiesMigrationReport report = new PropertiesMigrationReport();
Map<String, List<PropertyMigration>> properties = getMatchingProperties(deprecatedFilter());
Map<String, List<PropertyMigration>> properties = getMatchingProperties(
ConfigurationMetadataProperty::isDeprecated);
if (properties.isEmpty()) {
return report;
}
@ -129,11 +129,6 @@ class PropertiesMigrationReporter {
return null;
}
private Predicate<ConfigurationMetadataProperty> deprecatedFilter() {
return (property) -> property.getDeprecation() != null
&& property.getDeprecation().getLevel() == Deprecation.Level.ERROR;
}
private Map<String, ConfigurationPropertySource> getPropertySourcesAsMap() {
Map<String, ConfigurationPropertySource> map = new LinkedHashMap<>();
for (ConfigurationPropertySource source : ConfigurationPropertySources.get(this.environment)) {

@ -20,8 +20,7 @@
"name": "test.cache-seconds",
"type": "java.lang.Integer",
"deprecation": {
"replacement": "test.cache",
"level": "error"
"replacement": "test.cache"
}
},
{

Loading…
Cancel
Save