From c249d952abe2bb2fd18fbff69e5446c2403fd94c Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 22 Oct 2025 10:46:35 +0100 Subject: [PATCH] Omit properties deprecated at error level from new appendix Closes gh-47622 --- .../build/context/properties/ConfigurationProperty.java | 5 +++-- .../boot/build/context/properties/Snippets.java | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/context/properties/ConfigurationProperty.java b/buildSrc/src/main/java/org/springframework/boot/build/context/properties/ConfigurationProperty.java index f99fb254d08..f62a393cf61 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/context/properties/ConfigurationProperty.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/context/properties/ConfigurationProperty.java @@ -97,7 +97,7 @@ class ConfigurationProperty { Deprecation.fromJsonProperties(deprecation)); } - record Deprecation(String reason, String replacement, String since) { + record Deprecation(String reason, String replacement, String since, String level) { static Deprecation fromJsonProperties(Map property) { if (property == null) { @@ -106,7 +106,8 @@ class ConfigurationProperty { String reason = (String) property.get("reason"); String replacement = (String) property.get("replacement"); String since = (String) property.get("since"); - return new Deprecation(reason, replacement, since); + String level = (String) property.get("level"); + return new Deprecation(reason, replacement, since, level); } } diff --git a/buildSrc/src/main/java/org/springframework/boot/build/context/properties/Snippets.java b/buildSrc/src/main/java/org/springframework/boot/build/context/properties/Snippets.java index b0720cc2d36..5bfc1e0c770 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/context/properties/Snippets.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/context/properties/Snippets.java @@ -30,6 +30,8 @@ import java.util.stream.Collectors; import org.gradle.api.file.FileCollection; +import org.springframework.boot.build.context.properties.ConfigurationProperty.Deprecation; + /** * Configuration properties snippets. * @@ -118,7 +120,12 @@ class Snippets { } private boolean shouldAdd(ConfigurationProperty property) { - return (property == null || property.isDeprecated() == this.deprecated); + return (property == null || (property.isDeprecated() == this.deprecated && !deprecatedAtErrorLevel(property))); + } + + private boolean deprecatedAtErrorLevel(ConfigurationProperty property) { + Deprecation deprecation = property.getDeprecation(); + return deprecation != null && "error".equals(deprecation.level()); } private Asciidoc getAsciidoc(Snippet snippet, Table table) {