From f43419054ddb36286f5970565315b016edb61e89 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 13 May 2020 15:56:06 +0200 Subject: [PATCH] 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 --- .../migrator/PropertiesMigrationReporter.java | 11 +++-------- .../resources/metadata/type-conversion-metadata.json | 3 +-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporter.java b/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporter.java index fcda7c6057..d8d99d2c64 100644 --- a/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporter.java +++ b/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporter.java @@ -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> properties = getMatchingProperties(deprecatedFilter()); + Map> properties = getMatchingProperties( + ConfigurationMetadataProperty::isDeprecated); if (properties.isEmpty()) { return report; } @@ -129,11 +129,6 @@ class PropertiesMigrationReporter { return null; } - private Predicate deprecatedFilter() { - return (property) -> property.getDeprecation() != null - && property.getDeprecation().getLevel() == Deprecation.Level.ERROR; - } - private Map getPropertySourcesAsMap() { Map map = new LinkedHashMap<>(); for (ConfigurationPropertySource source : ConfigurationPropertySources.get(this.environment)) { diff --git a/spring-boot-project/spring-boot-properties-migrator/src/test/resources/metadata/type-conversion-metadata.json b/spring-boot-project/spring-boot-properties-migrator/src/test/resources/metadata/type-conversion-metadata.json index 3c247d1ebd..2119d57dca 100644 --- a/spring-boot-project/spring-boot-properties-migrator/src/test/resources/metadata/type-conversion-metadata.json +++ b/spring-boot-project/spring-boot-properties-migrator/src/test/resources/metadata/type-conversion-metadata.json @@ -20,8 +20,7 @@ "name": "test.cache-seconds", "type": "java.lang.Integer", "deprecation": { - "replacement": "test.cache", - "level": "error" + "replacement": "test.cache" } }, {