Skip to content

Commit eed7f75

Browse files
committed
Merge branch '3.4.x' into 3.5.x
Closes gh-48107
2 parents b543ab8 + b09b029 commit eed7f75

File tree

4 files changed

+133
-9
lines changed

4 files changed

+133
-9
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+
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@
324324
"defaultValue": true,
325325
"deprecation": {
326326
"level": "error",
327-
"replacement": "management.metrics.enable.process.files",
328327
"reason": "Instead, filter 'process.files' metrics."
329328
}
330329
},
@@ -335,7 +334,6 @@
335334
"defaultValue": true,
336335
"deprecation": {
337336
"level": "error",
338-
"replacement": "management.metrics.enable.jvm",
339337
"reason": "Instead, disable JvmMetricsAutoConfiguration or filter 'jvm' metrics."
340338
}
341339
},
@@ -346,7 +344,6 @@
346344
"defaultValue": true,
347345
"deprecation": {
348346
"level": "error",
349-
"replacement": "management.metrics.enable.logback",
350347
"reason": "Instead, disable LogbackMetricsAutoConfiguration or filter 'logback' metrics."
351348
}
352349
},
@@ -676,7 +673,7 @@
676673
"type": "java.lang.String",
677674
"deprecation": {
678675
"level": "error",
679-
"replacement": "management.dynatrace.metrics.export.device-id"
676+
"replacement": "management.dynatrace.metrics.export.v1.device-id"
680677
}
681678
},
682679
{
@@ -692,7 +689,7 @@
692689
"type": "java.lang.String",
693690
"deprecation": {
694691
"level": "error",
695-
"replacement": "management.dynatrace.metrics.export.group"
692+
"replacement": "management.dynatrace.metrics.export.v1.group"
696693
}
697694
},
698695
{
@@ -723,7 +720,7 @@
723720
"type": "java.lang.String",
724721
"deprecation": {
725722
"level": "error",
726-
"replacement": "management.dynatrace.metrics.export.technology-type"
723+
"replacement": "management.dynatrace.metrics.export.v1.technology-type"
727724
}
728725
},
729726
{
@@ -1499,15 +1496,15 @@
14991496
"type": "io.micrometer.prometheus.HistogramFlavor",
15001497
"deprecation": {
15011498
"level": "error",
1502-
"replacement": "management.prometheus.metrics.export.histogram-flavor"
1499+
"reason": "No longer supported by the Prometheus client."
15031500
}
15041501
},
15051502
{
15061503
"name": "management.metrics.export.prometheus.pushgateway.base-url",
15071504
"type": "java.lang.String",
15081505
"deprecation": {
15091506
"level": "error",
1510-
"replacement": "management.prometheus.metrics.export.pushgateway.base-url"
1507+
"replacement": "management.prometheus.metrics.export.pushgateway.address"
15111508
}
15121509
},
15131510
{

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,7 @@ public void setMultiplier(double multiplier) {
16421642
getBackoff().setMultiplier(multiplier);
16431643
}
16441644

1645-
@DeprecatedConfigurationProperty(replacement = "spring.kafka.retry.topic.backoff.maxDelay", since = "3.4.0")
1645+
@DeprecatedConfigurationProperty(replacement = "spring.kafka.retry.topic.backoff.max-delay", since = "3.4.0")
16461646
@Deprecated(since = "3.4.0", forRemoval = true)
16471647
public Duration getMaxDelay() {
16481648
return getBackoff().getMaxDelay();

spring-boot-project/spring-boot-docs/build.gradle

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

272+
def checkAggregatedSpringConfigurationMetadata = tasks.register("checkAggregatedSpringConfigurationMetadata", org.springframework.boot.build.context.properties.CheckAggregatedSpringConfigurationMetadata) {
273+
configurationPropertyMetadata = configurationPropertiesMetadataAggregate.files
274+
reportLocation = layout.buildDirectory.file("checkAggregatedSpringConfigurationMetadata/report.txt")
275+
}
276+
tasks.named("check") { dependsOn checkAggregatedSpringConfigurationMetadata }
277+
272278
tasks.register("documentConfigurationProperties", org.springframework.boot.build.context.properties.DocumentConfigurationProperties) {
273279
configurationPropertyMetadata = configurationPropertiesMetadataAggregate.files
274280
deprecated = false

0 commit comments

Comments
 (0)