Skip to content

Commit 9cc1813

Browse files
committed
Merge branch '3.5.x'
Closes gh-48110
2 parents e89bb1f + eed7f75 commit 9cc1813

File tree

5 files changed

+147
-31
lines changed

5 files changed

+147
-31
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/*
2+
* Copyright 2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.build.context.properties;
18+
19+
import java.io.File;
20+
import java.io.IOException;
21+
import java.nio.file.Files;
22+
import java.nio.file.StandardOpenOption;
23+
import java.util.ArrayList;
24+
import java.util.Iterator;
25+
import java.util.List;
26+
import java.util.Set;
27+
import java.util.stream.Collectors;
28+
29+
import org.gradle.api.DefaultTask;
30+
import org.gradle.api.Task;
31+
import org.gradle.api.file.FileCollection;
32+
import org.gradle.api.file.RegularFileProperty;
33+
import org.gradle.api.tasks.InputFiles;
34+
import org.gradle.api.tasks.OutputFile;
35+
import org.gradle.api.tasks.PathSensitive;
36+
import org.gradle.api.tasks.PathSensitivity;
37+
import org.gradle.api.tasks.TaskAction;
38+
import org.gradle.api.tasks.VerificationException;
39+
40+
/**
41+
* {@link Task} that checks aggregated Spring configuration metadata.
42+
*
43+
* @author Andy Wilkinson
44+
*/
45+
public abstract class CheckAggregatedSpringConfigurationMetadata extends DefaultTask {
46+
47+
private FileCollection configurationPropertyMetadata;
48+
49+
@OutputFile
50+
public abstract RegularFileProperty getReportLocation();
51+
52+
@InputFiles
53+
@PathSensitive(PathSensitivity.RELATIVE)
54+
public FileCollection getConfigurationPropertyMetadata() {
55+
return this.configurationPropertyMetadata;
56+
}
57+
58+
public void setConfigurationPropertyMetadata(FileCollection configurationPropertyMetadata) {
59+
this.configurationPropertyMetadata = configurationPropertyMetadata;
60+
}
61+
62+
@TaskAction
63+
void check() throws IOException {
64+
Report report = createReport();
65+
File reportFile = getReportLocation().get().getAsFile();
66+
Files.write(reportFile.toPath(), report, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
67+
if (report.hasProblems()) {
68+
throw new VerificationException(
69+
"Problems found in aggregated Spring configuration metadata. See " + reportFile + " for details.");
70+
}
71+
}
72+
73+
private Report createReport() {
74+
ConfigurationProperties configurationProperties = ConfigurationProperties
75+
.fromFiles(this.configurationPropertyMetadata);
76+
Set<String> propertyNames = configurationProperties.stream()
77+
.map(ConfigurationProperty::getName)
78+
.collect(Collectors.toSet());
79+
List<ConfigurationProperty> missingReplacement = configurationProperties.stream()
80+
.filter(ConfigurationProperty::isDeprecated)
81+
.filter((deprecated) -> {
82+
String replacement = deprecated.getDeprecation().replacement();
83+
return replacement != null && !propertyNames.contains(replacement);
84+
})
85+
.toList();
86+
return new Report(missingReplacement);
87+
}
88+
89+
private static final class Report implements Iterable<String> {
90+
91+
private final List<ConfigurationProperty> propertiesWithMissingReplacement;
92+
93+
private Report(List<ConfigurationProperty> propertiesWithMissingReplacement) {
94+
this.propertiesWithMissingReplacement = propertiesWithMissingReplacement;
95+
}
96+
97+
private boolean hasProblems() {
98+
return !this.propertiesWithMissingReplacement.isEmpty();
99+
}
100+
101+
@Override
102+
public Iterator<String> iterator() {
103+
List<String> lines = new ArrayList<>();
104+
if (this.propertiesWithMissingReplacement.isEmpty()) {
105+
lines.add("No problems found.");
106+
}
107+
else {
108+
lines.add("The following properties have a replacement that does not exist:");
109+
lines.add("");
110+
lines.addAll(this.propertiesWithMissingReplacement.stream()
111+
.map((property) -> "\t" + property.getName() + " (replacement "
112+
+ property.getDeprecation().replacement() + ")")
113+
.toList());
114+
}
115+
lines.add("");
116+
return lines.iterator();
117+
}
118+
119+
}
120+
121+
}

documentation/spring-boot-docs/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,12 @@ def configurationPropertiesMetadataAggregate = aggregates.create("configurationP
370370
usage = "configuration-properties-metadata"
371371
}
372372

373+
def checkAggregatedSpringConfigurationMetadata = tasks.register("checkAggregatedSpringConfigurationMetadata", org.springframework.boot.build.context.properties.CheckAggregatedSpringConfigurationMetadata) {
374+
configurationPropertyMetadata = configurationPropertiesMetadataAggregate.files
375+
reportLocation = layout.buildDirectory.file("checkAggregatedSpringConfigurationMetadata/report.txt")
376+
}
377+
tasks.named("check") { dependsOn checkAggregatedSpringConfigurationMetadata }
378+
373379
tasks.register("documentConfigurationProperties", org.springframework.boot.build.context.properties.DocumentConfigurationProperties) {
374380
configurationPropertyMetadata = configurationPropertiesMetadataAggregate.files
375381
deprecated = false

module/spring-boot-kafka/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
"name": "spring.kafka.retry.topic.max-delay",
139139
"type": "java.time.Duration",
140140
"deprecation": {
141-
"replacement": "spring.kafka.retry.topic.backoff.maxDelay",
141+
"replacement": "spring.kafka.retry.topic.backoff.max-delay",
142142
"since": "3.4.0"
143143
}
144144
},

module/spring-boot-micrometer-metrics/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"defaultValue": true,
1515
"deprecation": {
1616
"level": "error",
17-
"replacement": "management.metrics.enable.process.files",
1817
"reason": "Instead, filter 'process.files' metrics."
1918
}
2019
},
@@ -25,7 +24,6 @@
2524
"defaultValue": true,
2625
"deprecation": {
2726
"level": "error",
28-
"replacement": "management.metrics.enable.jvm",
2927
"reason": "Instead, disable JvmMetricsAutoConfiguration or filter 'jvm' metrics."
3028
}
3129
},
@@ -36,7 +34,6 @@
3634
"defaultValue": true,
3735
"deprecation": {
3836
"level": "error",
39-
"replacement": "management.metrics.enable.logback",
4037
"reason": "Instead, disable LogbackMetricsAutoConfiguration or filter 'logback' metrics."
4138
}
4239
},
@@ -366,7 +363,7 @@
366363
"type": "java.lang.String",
367364
"deprecation": {
368365
"level": "error",
369-
"replacement": "management.dynatrace.metrics.export.device-id"
366+
"replacement": "management.dynatrace.metrics.export.v1.device-id"
370367
}
371368
},
372369
{
@@ -382,7 +379,7 @@
382379
"type": "java.lang.String",
383380
"deprecation": {
384381
"level": "error",
385-
"replacement": "management.dynatrace.metrics.export.group"
382+
"replacement": "management.dynatrace.metrics.export.v1.group"
386383
}
387384
},
388385
{
@@ -413,7 +410,7 @@
413410
"type": "java.lang.String",
414411
"deprecation": {
415412
"level": "error",
416-
"replacement": "management.dynatrace.metrics.export.technology-type"
413+
"replacement": "management.dynatrace.metrics.export.v1.technology-type"
417414
}
418415
},
419416
{
@@ -1189,15 +1186,15 @@
11891186
"type": "io.micrometer.prometheus.HistogramFlavor",
11901187
"deprecation": {
11911188
"level": "error",
1192-
"replacement": "management.prometheus.metrics.export.histogram-flavor"
1189+
"reason": "No longer supported by the Prometheus client."
11931190
}
11941191
},
11951192
{
11961193
"name": "management.metrics.export.prometheus.pushgateway.base-url",
11971194
"type": "java.lang.String",
11981195
"deprecation": {
11991196
"level": "error",
1200-
"replacement": "management.prometheus.metrics.export.pushgateway.base-url"
1197+
"replacement": "management.prometheus.metrics.export.pushgateway.address"
12011198
}
12021199
},
12031200
{
@@ -1269,77 +1266,78 @@
12691266
"type": "java.lang.String",
12701267
"deprecation": {
12711268
"level": "error",
1272-
"replacement": "management.signalfx.metrics.export.access-token"
1269+
"reason": "SignalFX is no longer supported."
12731270
}
12741271
},
12751272
{
12761273
"name": "management.metrics.export.signalfx.batch-size",
12771274
"type": "java.lang.Integer",
12781275
"deprecation": {
12791276
"level": "error",
1280-
"replacement": "management.signalfx.metrics.export.batch-size"
1277+
"reason": "SignalFX is no longer supported."
12811278
}
12821279
},
12831280
{
12841281
"name": "management.metrics.export.signalfx.connect-timeout",
12851282
"type": "java.time.Duration",
12861283
"deprecation": {
12871284
"level": "error",
1288-
"replacement": "management.signalfx.metrics.export.connect-timeout"
1285+
"reason": "SignalFX is no longer supported."
12891286
}
12901287
},
12911288
{
12921289
"name": "management.metrics.export.signalfx.enabled",
12931290
"type": "java.lang.Boolean",
12941291
"deprecation": {
12951292
"level": "error",
1296-
"replacement": "management.signalfx.metrics.export.enabled"
1293+
"reason": "SignalFX is no longer supported."
12971294
}
12981295
},
12991296
{
13001297
"name": "management.metrics.export.signalfx.num-threads",
13011298
"type": "java.lang.Integer",
13021299
"deprecation": {
1303-
"level": "error"
1300+
"level": "error",
1301+
"reason": "SignalFX is no longer supported."
13041302
}
13051303
},
13061304
{
13071305
"name": "management.metrics.export.signalfx.published-histogram-type",
13081306
"deprecation": {
13091307
"level": "error",
1310-
"replacement": "management.signalfx.metrics.export.published-histogram-type"
1308+
"reason": "SignalFX is no longer supported."
13111309
}
13121310
},
13131311
{
13141312
"name": "management.metrics.export.signalfx.read-timeout",
13151313
"type": "java.time.Duration",
13161314
"deprecation": {
13171315
"level": "error",
1318-
"replacement": "management.signalfx.metrics.export.read-timeout"
1316+
"reason": "SignalFX is no longer supported."
13191317
}
13201318
},
13211319
{
13221320
"name": "management.metrics.export.signalfx.source",
13231321
"type": "java.lang.String",
13241322
"deprecation": {
13251323
"level": "error",
1326-
"replacement": "management.signalfx.metrics.export.source"
1324+
"reason": "SignalFX is no longer supported."
13271325
}
13281326
},
13291327
{
13301328
"name": "management.metrics.export.signalfx.step",
13311329
"type": "java.time.Duration",
13321330
"deprecation": {
13331331
"level": "error",
1334-
"replacement": "management.signalfx.metrics.export.step"
1332+
"reason": "SignalFX is no longer supported."
13351333
}
13361334
},
13371335
{
13381336
"name": "management.metrics.export.signalfx.uri",
13391337
"type": "java.lang.String",
13401338
"deprecation": {
13411339
"level": "error",
1342-
"replacement": "management.signalfx.metrics.export.uri"
1340+
"reason": "SignalFX is no longer supported."
13431341
}
13441342
},
13451343
{

module/spring-boot-opentelemetry/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,10 @@
44
{
55
"name": "management.logging.export.otlp.enabled",
66
"type": "java.lang.Boolean",
7-
"defaultValue": true,
7+
"defaultValue": true,
88
"description": "Whether auto-configuration of logging is enabled to export logs over OTLP."
9-
},
10-
{
11-
"name": "management.otlp.logging",
12-
"type": "org.springframework.boot.opentelemetry.actuate.autoconfigure.logging.OpenTelemetryLoggingExportProperties",
13-
"sourceType": "org.springframework.boot.opentelemetry.actuate.autoconfigure.logging.OpenTelemetryLoggingExportProperties",
14-
"deprecation": {
15-
"replacement": "management.opentelemetry.logging.export.otlp",
16-
"level": "error"
17-
}
189
},
19-
{
10+
{
2011
"name": "management.otlp.logging.compression",
2112
"type": "org.springframework.boot.opentelemetry.actuate.autoconfigure.logging.OpenTelemetryLoggingExportProperties$Compression",
2213
"description": "Method used to compress the payload.",
@@ -48,7 +39,7 @@
4839
"level": "error"
4940
}
5041
},
51-
{
42+
{
5243
"name": "management.otlp.logging.export.enabled",
5344
"deprecation": {
5445
"replacement": "management.logging.export.otlp.enabled",

0 commit comments

Comments
 (0)