Skip to content

Commit f434190

Browse files
committed
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
1 parent 786dae5 commit f434190

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporter.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,6 @@
2525

2626
import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
2727
import org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository;
28-
import org.springframework.boot.configurationmetadata.Deprecation;
2928
import org.springframework.boot.context.properties.source.ConfigurationProperty;
3029
import org.springframework.boot.context.properties.source.ConfigurationPropertyName;
3130
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
@@ -62,7 +61,8 @@ class PropertiesMigrationReporter {
6261
*/
6362
PropertiesMigrationReport getReport() {
6463
PropertiesMigrationReport report = new PropertiesMigrationReport();
65-
Map<String, List<PropertyMigration>> properties = getMatchingProperties(deprecatedFilter());
64+
Map<String, List<PropertyMigration>> properties = getMatchingProperties(
65+
ConfigurationMetadataProperty::isDeprecated);
6666
if (properties.isEmpty()) {
6767
return report;
6868
}
@@ -129,11 +129,6 @@ private ConfigurationMetadataProperty detectMapValueReplacement(String fullId) {
129129
return null;
130130
}
131131

132-
private Predicate<ConfigurationMetadataProperty> deprecatedFilter() {
133-
return (property) -> property.getDeprecation() != null
134-
&& property.getDeprecation().getLevel() == Deprecation.Level.ERROR;
135-
}
136-
137132
private Map<String, ConfigurationPropertySource> getPropertySourcesAsMap() {
138133
Map<String, ConfigurationPropertySource> map = new LinkedHashMap<>();
139134
for (ConfigurationPropertySource source : ConfigurationPropertySources.get(this.environment)) {

spring-boot-project/spring-boot-properties-migrator/src/test/resources/metadata/type-conversion-metadata.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"name": "test.cache-seconds",
2121
"type": "java.lang.Integer",
2222
"deprecation": {
23-
"replacement": "test.cache",
24-
"level": "error"
23+
"replacement": "test.cache"
2524
}
2625
},
2726
{

0 commit comments

Comments
 (0)