From fe27ce8c9166e148fc778857f117c6abe8e983c2 Mon Sep 17 00:00:00 2001 From: Spring Builds Date: Thu, 24 Mar 2022 12:45:53 +0000 Subject: [PATCH 01/25] Next development version (v2.5.12-SNAPSHOT) --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index c6373c647838..2d3cbd610af2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=2.5.11-SNAPSHOT +version=2.5.12-SNAPSHOT org.gradle.caching=true org.gradle.parallel=true From 7072e9e75b5dff262e924845399c44dd9b22e70a Mon Sep 17 00:00:00 2001 From: Spring Builds Date: Thu, 24 Mar 2022 14:23:11 +0000 Subject: [PATCH 02/25] Next development version (v2.6.6-SNAPSHOT) --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d42bcbe13f6f..a81b6f9aa1a4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=2.6.5-SNAPSHOT +version=2.6.6-SNAPSHOT org.gradle.caching=true org.gradle.parallel=true From 713edf36251ebb06f60283a26b836fdb1977b009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez?= Date: Thu, 24 Mar 2022 15:05:52 -0600 Subject: [PATCH 03/25] Switch to GA releases for Java 18 update checks See gh-30415 --- ci/scripts/detect-jdk-updates.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/detect-jdk-updates.sh b/ci/scripts/detect-jdk-updates.sh index e7cc0968cd38..3d67c7773ea6 100755 --- a/ci/scripts/detect-jdk-updates.sh +++ b/ci/scripts/detect-jdk-updates.sh @@ -21,7 +21,7 @@ case "$JDK_VERSION" in ISSUE_TITLE="Upgrade Java 17 version in CI image" ;; java18) - BASE_URL="https://api.adoptium.net/v3/assets/feature_releases/18/ea" + BASE_URL="https://api.adoptium.net/v3/assets/feature_releases/18/ga" ISSUE_TITLE="Upgrade Java 18 version in CI image" ;; *) From e9c433a0b781c0b4d9c91d035067fa2c48068a6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez?= Date: Thu, 24 Mar 2022 15:52:43 -0600 Subject: [PATCH 04/25] Enable Java 18 for LoaderIntegrationTests See gh-30422 --- .../org/springframework/boot/loader/LoaderIntegrationTests.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-loader-tests/src/intTest/java/org/springframework/boot/loader/LoaderIntegrationTests.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-loader-tests/src/intTest/java/org/springframework/boot/loader/LoaderIntegrationTests.java index 5162ea39677c..bc2a0d950cb5 100644 --- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-loader-tests/src/intTest/java/org/springframework/boot/loader/LoaderIntegrationTests.java +++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-loader-tests/src/intTest/java/org/springframework/boot/loader/LoaderIntegrationTests.java @@ -81,6 +81,7 @@ static Stream javaRuntimes() { javaRuntimes.add(JavaRuntime.openJdk(JavaVersion.EIGHT)); javaRuntimes.add(JavaRuntime.openJdk(JavaVersion.ELEVEN)); javaRuntimes.add(JavaRuntime.openJdk(JavaVersion.SEVENTEEN)); + javaRuntimes.add(JavaRuntime.openJdk(JavaVersion.EIGHTEEN)); javaRuntimes.add(JavaRuntime.oracleJdk17()); return javaRuntimes.stream().filter(JavaRuntime::isCompatible); } From e36ac6c155d0ec40bc57d8696bf616410a778dfc Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 25 Mar 2022 11:02:09 +0000 Subject: [PATCH 05/25] Polish "Enable Java 18 for LoaderIntegrationTests" See gh-30422 --- .../springframework/boot/loader/LoaderIntegrationTests.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-loader-tests/src/intTest/java/org/springframework/boot/loader/LoaderIntegrationTests.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-loader-tests/src/intTest/java/org/springframework/boot/loader/LoaderIntegrationTests.java index bc2a0d950cb5..8aa27b2efdcd 100644 --- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-loader-tests/src/intTest/java/org/springframework/boot/loader/LoaderIntegrationTests.java +++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-loader-tests/src/intTest/java/org/springframework/boot/loader/LoaderIntegrationTests.java @@ -23,8 +23,6 @@ import java.util.function.Supplier; import java.util.stream.Stream; -import org.junit.jupiter.api.condition.EnabledForJreRange; -import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.testcontainers.containers.GenericContainer; @@ -52,7 +50,6 @@ class LoaderIntegrationTests { @ParameterizedTest @MethodSource("javaRuntimes") - @EnabledForJreRange(max = JRE.JAVA_17) void readUrlsWithoutWarning(JavaRuntime javaRuntime) { try (GenericContainer container = createContainer(javaRuntime)) { container.start(); From 0e99c57f8e33e900dfb78333f02284d78eb3329e Mon Sep 17 00:00:00 2001 From: Yanming Zhou Date: Thu, 24 Mar 2022 09:47:46 +0800 Subject: [PATCH 06/25] Prevent imports of null-safety annotations See gh-30406 --- src/checkstyle/checkstyle.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index 148febe43fcc..90f953dfc567 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -13,7 +13,7 @@ name="com.puppycrawl.tools.checkstyle.checks.imports.IllegalImportCheck"> + value="^sun.*, ^org\.apache\.commons\.(?!compress|dbcp2|logging|pool2).*, ^com\.datastax\.oss\.driver\.shaded.*, ^com\.google\.common.*, ^io\.micrometer\.shaded.*, ^org\.flywaydb\.core\.internal.*, ^org\.jetbrains\.annotations.*, ^org\.testcontainers\.shaded.*" /> From c087d609a0417bc09b1919855a6decdf3a61d79c Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 25 Mar 2022 11:43:57 +0000 Subject: [PATCH 07/25] Polish "Prevent imports of null-safety annotations" See gh-30406 --- src/checkstyle/import-control.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/checkstyle/import-control.xml b/src/checkstyle/import-control.xml index db983dd578f0..7c7f8aa6abd1 100644 --- a/src/checkstyle/import-control.xml +++ b/src/checkstyle/import-control.xml @@ -2,6 +2,7 @@ + @@ -45,6 +46,13 @@ + + + + + + + @@ -56,6 +64,9 @@ + + + From 0ff8119a1b343be929d8f0f9283043f0acb4810e Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Fri, 25 Mar 2022 14:54:39 +0100 Subject: [PATCH 08/25] Sort entries in additional-spring-configuration metadata alphabetically Closes gh-30434 --- ...itional-spring-configuration-metadata.json | 1 + ...itional-spring-configuration-metadata.json | 4 +- ...itional-spring-configuration-metadata.json | 33 +-- ...itional-spring-configuration-metadata.json | 4 +- ...itional-spring-configuration-metadata.json | 212 +++++++++--------- 5 files changed, 130 insertions(+), 124 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 0193f7d73df2..9c35406c44f0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,4 +1,5 @@ { + "groups": [], "properties": [ { "name": "info", diff --git a/spring-boot-project/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json index c50a6d86e8d1..cd08d79f2272 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,4 +1,5 @@ { + "groups": [], "properties": [ { "name": "management.endpoints.migrate-legacy-ids", @@ -6,5 +7,6 @@ "description": "Whether to transparently migrate legacy endpoint IDs.", "defaultValue": false } - ] + ], + "hints": [] } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 88d480c28459..ceea4b65066c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,4 +1,5 @@ { + "groups": [], "properties": [ { "name": "server.compression.enabled", @@ -542,6 +543,14 @@ "level": "error" } }, + { + "name": "spring.data.cassandra.pool.heartbeat-interval", + "defaultValue": "30s" + }, + { + "name": "spring.data.cassandra.pool.idle-timeout", + "defaultValue": "5s" + }, { "name": "spring.data.cassandra.pool.max-queue-size", "type": "java.lang.Integer", @@ -577,14 +586,14 @@ "name": "spring.data.cassandra.request.page-size", "defaultValue": 5000 }, - { - "name": "spring.data.cassandra.request.timeout", - "defaultValue": "2s" - }, { "name": "spring.data.cassandra.request.throttler.type", "defaultValue": "none" }, + { + "name": "spring.data.cassandra.request.timeout", + "defaultValue": "2s" + }, { "name": "spring.data.cassandra.retry-policy", "type": "java.lang.Class", @@ -593,14 +602,6 @@ "level": "error" } }, - { - "name": "spring.data.cassandra.pool.heartbeat-interval", - "defaultValue": "30s" - }, - { - "name": "spring.data.cassandra.pool.idle-timeout", - "defaultValue": "5s" - }, { "name": "spring.data.couchbase.consistency", "type": "org.springframework.data.couchbase.core.query.Consistency", @@ -1607,6 +1608,10 @@ "name": "spring.neo4j.uri", "defaultValue": "bolt://localhost:7687" }, + { + "name": "spring.netty.leak-detection", + "defaultValue": "simple" + }, { "name": "spring.quartz.jdbc.comment-prefix", "defaultValue": [ @@ -1807,10 +1812,6 @@ "name": "spring.webservices.wsdl-locations", "type": "java.util.List", "description": "Comma-separated list of locations of WSDLs and accompanying XSDs to be exposed as beans." - }, - { - "name": "spring.netty.leak-detection", - "defaultValue": "simple" } ], "hints": [ diff --git a/spring-boot-project/spring-boot-devtools/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-devtools/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 78be077d7783..f852a8ca6048 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-devtools/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,4 +1,5 @@ { + "groups": [], "properties": [ { "name": "spring.devtools.add-properties", @@ -6,5 +7,6 @@ "description": "Whether to enable development property defaults.", "defaultValue": true } - ] + ], + "hints": [] } diff --git a/spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 3369b0676cf1..20ca9f32750c 100644 --- a/spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -13,12 +13,6 @@ "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", "defaultValue": false }, - { - "name": "logging.config", - "type": "java.lang.String", - "description": "Location of the logging configuration file. For instance, `classpath:logback.xml` for Logback.", - "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener" - }, { "name": "logging.charset.console", "type": "java.nio.charset.Charset", @@ -29,6 +23,12 @@ "type": "java.nio.charset.Charset", "description": "Charset to use for file output." }, + { + "name": "logging.config", + "type": "java.lang.String", + "description": "Location of the logging configuration file. For instance, `classpath:logback.xml` for Logback.", + "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener" + }, { "name": "logging.exception-conversion-word", "type": "java.lang.String", @@ -45,6 +45,36 @@ "level": "error" } }, + { + "name": "logging.file.clean-history-on-start", + "type": "java.lang.Boolean", + "description": "Whether to clean the archive log files on startup. Only supported with the default logback setup.", + "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", + "defaultValue": false, + "deprecation": { + "replacement": "logging.logback.rollingpolicy.clean-history-on-start" + } + }, + { + "name": "logging.file.max-history", + "type": "java.lang.Integer", + "description": "Maximum number of archive log files to keep. Only supported with the default logback setup.", + "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", + "defaultValue": 7, + "deprecation": { + "replacement": "logging.logback.rollingpolicy.max-history" + } + }, + { + "name": "logging.file.max-size", + "type": "org.springframework.util.unit.DataSize", + "description": "Maximum log file size. Only supported with the default logback setup.", + "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", + "defaultValue": "10MB", + "deprecation": { + "replacement": "logging.logback.rollingpolicy.max-file-size" + } + }, { "name": "logging.file.name", "type": "java.lang.String", @@ -57,6 +87,16 @@ "description": "Location of the log file. For instance, `/var/log`.", "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener" }, + { + "name": "logging.file.total-size-cap", + "type": "org.springframework.util.unit.DataSize", + "description": "Total size of log backups to be kept. Only supported with the default logback setup.", + "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", + "defaultValue": "0B", + "deprecation": { + "replacement": "logging.logback.rollingpolicy.total-size-cap" + } + }, { "name": "logging.group", "type": "java.util.Map>", @@ -69,6 +109,41 @@ "description": "Log levels severity mapping. For instance, `logging.level.org.springframework=DEBUG`.", "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener" }, + { + "name": "logging.logback.rollingpolicy.clean-history-on-start", + "type": "java.lang.Boolean", + "description": "Whether to clean the archive log files on startup.", + "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", + "defaultValue": false + }, + { + "name": "logging.logback.rollingpolicy.file-name-pattern", + "type": "java.lang.String", + "description": "Pattern for rolled-over log file names.", + "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", + "defaultValue": "${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz" + }, + { + "name": "logging.logback.rollingpolicy.max-file-size", + "type": "org.springframework.util.unit.DataSize", + "description": "Maximum log file size.", + "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", + "defaultValue": "10MB" + }, + { + "name": "logging.logback.rollingpolicy.max-history", + "type": "java.lang.Integer", + "description": "Maximum number of archive log files to keep.", + "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", + "defaultValue": 7 + }, + { + "name": "logging.logback.rollingpolicy.total-size-cap", + "type": "org.springframework.util.unit.DataSize", + "description": "Total size of log backups to be kept.", + "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", + "defaultValue": "0B" + }, { "name": "logging.path", "type": "java.lang.String", @@ -106,13 +181,6 @@ "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", "defaultValue": "%5p" }, - { - "name": "logging.register-shutdown-hook", - "type": "java.lang.Boolean", - "description": "Register a shutdown hook for the logging system when it is initialized. Disabled automatically when deployed as a war file.", - "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", - "defaultValue": true - }, { "name": "logging.pattern.rolling-file-name", "type": "java.lang.String", @@ -124,79 +192,11 @@ } }, { - "name": "logging.file.clean-history-on-start", - "type": "java.lang.Boolean", - "description": "Whether to clean the archive log files on startup. Only supported with the default logback setup.", - "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", - "defaultValue": false, - "deprecation": { - "replacement": "logging.logback.rollingpolicy.clean-history-on-start" - } - }, - { - "name": "logging.file.max-size", - "type": "org.springframework.util.unit.DataSize", - "description": "Maximum log file size. Only supported with the default logback setup.", - "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", - "defaultValue": "10MB", - "deprecation": { - "replacement": "logging.logback.rollingpolicy.max-file-size" - } - }, - { - "name": "logging.file.total-size-cap", - "type": "org.springframework.util.unit.DataSize", - "description": "Total size of log backups to be kept. Only supported with the default logback setup.", - "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", - "defaultValue": "0B", - "deprecation": { - "replacement": "logging.logback.rollingpolicy.total-size-cap" - } - }, - { - "name": "logging.file.max-history", - "type": "java.lang.Integer", - "description": "Maximum number of archive log files to keep. Only supported with the default logback setup.", - "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", - "defaultValue": 7, - "deprecation": { - "replacement": "logging.logback.rollingpolicy.max-history" - } - }, - { - "name": "logging.logback.rollingpolicy.file-name-pattern", - "type": "java.lang.String", - "description": "Pattern for rolled-over log file names.", - "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", - "defaultValue": "${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz" - }, - { - "name": "logging.logback.rollingpolicy.clean-history-on-start", + "name": "logging.register-shutdown-hook", "type": "java.lang.Boolean", - "description": "Whether to clean the archive log files on startup.", - "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", - "defaultValue": false - }, - { - "name": "logging.logback.rollingpolicy.max-file-size", - "type": "org.springframework.util.unit.DataSize", - "description": "Maximum log file size.", - "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", - "defaultValue": "10MB" - }, - { - "name": "logging.logback.rollingpolicy.total-size-cap", - "type": "org.springframework.util.unit.DataSize", - "description": "Total size of log backups to be kept.", - "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", - "defaultValue": "0B" - }, - { - "name": "logging.logback.rollingpolicy.max-history", - "type": "java.lang.Integer", - "description": "Maximum number of archive log files to keep.", + "description": "Register a shutdown hook for the logging system when it is initialized. Disabled automatically when deployed as a war file.", "sourceType": "org.springframework.boot.context.logging.LoggingApplicationListener", - "defaultValue": 7 + "defaultValue": true }, { "name": "spring.application.index", @@ -917,18 +917,18 @@ "description": "Name of the profile to enable if no profile is active.", "defaultValue": "default" }, - { - "name": "spring.profiles.include", - "type": "java.util.List", - "sourceType": "org.springframework.boot.context.config.Profiles", - "description": "Unconditionally activate the specified comma-separated list of profiles (or list of profiles if using YAML)." - }, { "name": "spring.profiles.group", "type": "java.util.Map>", "sourceType": "org.springframework.boot.context.config.Profiles", "description": "Profile groups to define a logical name for a related group of profiles." }, + { + "name": "spring.profiles.include", + "type": "java.util.List", + "sourceType": "org.springframework.boot.context.config.Profiles", + "description": "Unconditionally activate the specified comma-separated list of profiles (or list of profiles if using YAML)." + }, { "name": "spring.reactor.debug-agent.enabled", "type": "java.lang.Boolean", @@ -1009,22 +1009,6 @@ } ] }, - { - "name": "spring.profiles.active", - "providers": [ - { - "name": "spring-profile-name" - } - ] - }, - { - "name": "spring.profiles.include", - "providers": [ - { - "name": "spring-profile-name" - } - ] - }, { "name": "spring.config.import", "values": [ @@ -1043,6 +1027,22 @@ "name": "any" } ] + }, + { + "name": "spring.profiles.active", + "providers": [ + { + "name": "spring-profile-name" + } + ] + }, + { + "name": "spring.profiles.include", + "providers": [ + { + "name": "spring-profile-name" + } + ] } ] } From 24e748d5cd8c3c8ef580d9cf7184db3be37384ab Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Fri, 25 Mar 2022 16:13:28 +0100 Subject: [PATCH 09/25] Remove unnecessary entries in additional config metadata Add the 'enabled' fields directly to the classes instead. Closes gh-30439 --- .../metrics/export/jmx/JmxProperties.java | 15 ++++++++++++++- .../prometheus/PrometheusProperties.java | 15 ++++++++++++++- .../export/simple/SimpleProperties.java | 15 ++++++++++++++- ...ditional-spring-configuration-metadata.json | 18 ------------------ 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxProperties.java index 2d927d34fe06..ea4adb908203 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 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. @@ -31,6 +31,11 @@ @ConfigurationProperties(prefix = "management.metrics.export.jmx") public class JmxProperties { + /** + * Whether exporting of metrics to this backend is enabled. + */ + private boolean enabled = true; + /** * Metrics JMX domain name. */ @@ -57,4 +62,12 @@ public void setStep(Duration step) { this.step = step; } + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusProperties.java index 3d3013665070..41b7845f62e4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2022 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. @@ -36,6 +36,11 @@ @ConfigurationProperties(prefix = "management.metrics.export.prometheus") public class PrometheusProperties { + /** + * Whether exporting of metrics to this backend is enabled. + */ + private boolean enabled = true; + /** * Whether to enable publishing descriptions as part of the scrape payload to * Prometheus. Turn this off to minimize the amount of data sent on each scrape. @@ -82,6 +87,14 @@ public void setStep(Duration step) { this.step = step; } + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public Pushgateway getPushgateway() { return this.pushgateway; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleProperties.java index 5433ea65107a..8d4a1e263d02 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 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. @@ -34,6 +34,11 @@ @ConfigurationProperties(prefix = "management.metrics.export.simple") public class SimpleProperties { + /** + * Whether exporting of metrics to this backend is enabled. + */ + private boolean enabled = true; + /** * Step size (i.e. reporting frequency) to use. */ @@ -44,6 +49,14 @@ public class SimpleProperties { */ private CountingMode mode = CountingMode.CUMULATIVE; + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public Duration getStep() { return this.step; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 9c35406c44f0..f84df137a23d 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -421,12 +421,6 @@ "level": "error" } }, - { - "name": "management.metrics.export.jmx.enabled", - "type": "java.lang.Boolean", - "description": "Whether exporting of metrics to JMX is enabled.", - "defaultValue": true - }, { "name": "management.metrics.export.kairos.num-threads", "type": "java.lang.Integer", @@ -444,12 +438,6 @@ "level": "error" } }, - { - "name": "management.metrics.export.prometheus.enabled", - "type": "java.lang.Boolean", - "description": "Whether exporting of metrics to Prometheus is enabled.", - "defaultValue": true - }, { "name": "management.metrics.export.prometheus.histogram-flavor", "defaultValue": "prometheus" @@ -467,12 +455,6 @@ "level": "error" } }, - { - "name": "management.metrics.export.simple.enabled", - "type": "java.lang.Boolean", - "description": "Whether, in the absence of any other exporter, exporting of metrics to an in-memory backend is enabled.", - "defaultValue": true - }, { "name": "management.metrics.export.simple.mode", "defaultValue": "cumulative" From f9d1c400a7ad131d19daa0e52ef5cfe7b528ebcf Mon Sep 17 00:00:00 2001 From: Vikey Chen Date: Sat, 26 Mar 2022 23:19:41 +0800 Subject: [PATCH 10/25] Remove redundant Javadoc See gh-30446 --- .../boot/web/servlet/server/CookieSameSiteSupplier.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/CookieSameSiteSupplier.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/CookieSameSiteSupplier.java index 6c7128e89590..189c50b28067 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/CookieSameSiteSupplier.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/CookieSameSiteSupplier.java @@ -20,9 +20,6 @@ import java.util.function.Supplier; import java.util.regex.Pattern; -/** - * @author Phillip Webb - */ import javax.servlet.http.Cookie; import org.springframework.boot.web.server.Cookie.SameSite; From 5dc4ff5366468dc98f83345a22345b10d557f248 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 28 Mar 2022 09:46:21 +0200 Subject: [PATCH 11/25] Update copyright year of changed file See gh-30446 --- .../boot/web/servlet/server/CookieSameSiteSupplier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/CookieSameSiteSupplier.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/CookieSameSiteSupplier.java index 189c50b28067..3d6cf545fa79 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/CookieSameSiteSupplier.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/CookieSameSiteSupplier.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. From d57456361620bc20c6cd3623b7482d90013bf914 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 29 Mar 2022 14:14:28 +0100 Subject: [PATCH 12/25] Document @ConstructorBinding and @DefaultValue with records Closes gh-30460 --- .../asciidoc/features/external-config.adoc | 7 ++- .../AbstractMetadataGenerationTests.java | 10 +++- ...ationMetadataAnnotationProcessorTests.java | 46 ++++++++++++++++++- .../ConfigurationPropertiesBeanTests.java | 34 +++++++++++++- .../bind/ValueObjectBinderTests.java | 38 ++++++++++++++- 5 files changed, 129 insertions(+), 6 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/external-config.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/external-config.adoc index d157d00a5750..6c4878a7c833 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/external-config.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/external-config.adoc @@ -721,11 +721,14 @@ include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/con In this setup, the `@ConstructorBinding` annotation is used to indicate that constructor binding should be used. This means that the binder will expect to find a constructor with the parameters that you wish to have bound. +If you are using Java 16 or later, constructor binding can be used with records. Nested members of a `@ConstructorBinding` class (such as `Security` in the example above) will also be bound via their constructor. -Default values can be specified using `@DefaultValue` and the same conversion service will be applied to coerce the `String` value to the target type of a missing property. -By default, if no properties are bound to `Security`, the `MyProperties` instance will contain a `null` value for `security`. +Default values can be specified using `@DefaultValue` on a constructor parameter or, when using Java 16 or later, a record component. +The conversion service will be applied to coerce the `String` value to the target type of a missing property. + +Referring to the previous example, if no properties are bound to `Security`, the `MyProperties` instance will contain a `null` value for `security`. If you wish you return a non-null instance of `Security` even when no properties are bound to it, you can use an empty `@DefaultValue` annotation to do so: [source,java,indent=0,subs="verbatim"] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/AbstractMetadataGenerationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/AbstractMetadataGenerationTests.java index 1af2311b2a11..8cd35bd6fa1c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/AbstractMetadataGenerationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/AbstractMetadataGenerationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 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. @@ -18,6 +18,7 @@ import java.io.File; import java.io.IOException; +import java.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.io.TempDir; @@ -54,4 +55,11 @@ protected ConfigurationMetadata compile(Class... types) { return processor.getMetadata(); } + protected ConfigurationMetadata compile(File... sources) { + TestConfigurationMetadataAnnotationProcessor processor = new TestConfigurationMetadataAnnotationProcessor( + this.compiler.getOutputLocation()); + this.compiler.getTask(Arrays.asList(sources)).call(processor); + return processor.getMetadata(); + } + } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java index b942ee93c0c0..b4425f1edf9e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -16,7 +16,15 @@ package org.springframework.boot.configurationprocessor; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; + import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledForJreRange; +import org.junit.jupiter.api.condition.JRE; +import org.junit.jupiter.api.io.TempDir; import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata; import org.springframework.boot.configurationprocessor.metadata.ItemMetadata; @@ -402,4 +410,40 @@ void recursivePropertiesDoNotCauseAStackOverflow() { compile(RecursiveProperties.class); } + @Test + @EnabledForJreRange(min = JRE.JAVA_16) + void explicityBoundRecordProperties(@TempDir File temp) throws IOException { + File exampleRecord = new File(temp, "ExampleRecord.java"); + try (PrintWriter writer = new PrintWriter(new FileWriter(exampleRecord))) { + writer.println("@org.springframework.boot.configurationsample.ConstructorBinding"); + writer.println("@org.springframework.boot.configurationsample.ConfigurationProperties(\"explicit\")"); + writer.println("public record ExampleRecord(String someString, Integer someInteger) {"); + writer.println("}"); + } + ConfigurationMetadata metadata = compile(exampleRecord); + assertThat(metadata).has(Metadata.withProperty("explicit.some-string")); + assertThat(metadata).has(Metadata.withProperty("explicit.some-integer")); + } + + @Test + @EnabledForJreRange(min = JRE.JAVA_16) + void explicitlyBoundRecordPropertiesWithDefaultValues(@TempDir File temp) throws IOException { + File exampleRecord = new File(temp, "ExampleRecord.java"); + try (PrintWriter writer = new PrintWriter(new FileWriter(exampleRecord))) { + writer.println("@org.springframework.boot.configurationsample.ConstructorBinding"); + writer.println( + "@org.springframework.boot.configurationsample.ConfigurationProperties(\"record.defaults\")"); + writer.println("public record ExampleRecord("); + writer.println("@org.springframework.boot.configurationsample.DefaultValue(\"An1s9n\") String someString,"); + writer.println("@org.springframework.boot.configurationsample.DefaultValue(\"594\") Integer someInteger"); + writer.println(") {"); + writer.println("}"); + } + ConfigurationMetadata metadata = compile(exampleRecord); + assertThat(metadata) + .has(Metadata.withProperty("record.defaults.some-string", String.class).withDefaultValue("An1s9n")); + assertThat(metadata) + .has(Metadata.withProperty("record.defaults.some-integer", Integer.class).withDefaultValue(594)); + } + } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanTests.java index 1530b2913917..ccd9bc6df038 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2022 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. @@ -16,9 +16,15 @@ package org.springframework.boot.context.properties; +import java.lang.reflect.Constructor; import java.util.Map; +import net.bytebuddy.ByteBuddy; +import net.bytebuddy.ClassFileVersion; +import net.bytebuddy.description.annotation.AnnotationDescription; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledForJreRange; +import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.api.function.ThrowingConsumer; import org.springframework.boot.context.properties.ConfigurationPropertiesBean.BindMethod; @@ -216,6 +222,32 @@ void forValueObjectReturnsBean() { .getBindConstructor(ConstructorBindingOnConstructor.class, false)).isNotNull(); } + @Test + @EnabledForJreRange(min = JRE.JAVA_16) + void forValueObjectWithRecordReturnsBean() { + Class constructorBindingRecord = new ByteBuddy(ClassFileVersion.JAVA_V16).makeRecord() + .name("org.springframework.boot.context.properties.RecordProperties") + .annotateType(AnnotationDescription.Builder.ofType(ConfigurationProperties.class) + .define("prefix", "explicit").build()) + .annotateType(AnnotationDescription.Builder.ofType(ConstructorBinding.class).build()) + .defineRecordComponent("someString", String.class).defineRecordComponent("someInteger", Integer.class) + .make().load(getClass().getClassLoader()).getLoaded(); + ConfigurationPropertiesBean propertiesBean = ConfigurationPropertiesBean + .forValueObject(constructorBindingRecord, "constructorBindingRecord"); + assertThat(propertiesBean.getName()).isEqualTo("constructorBindingRecord"); + assertThat(propertiesBean.getInstance()).isNull(); + assertThat(propertiesBean.getType()).isEqualTo(constructorBindingRecord); + assertThat(propertiesBean.getBindMethod()).isEqualTo(BindMethod.VALUE_OBJECT); + assertThat(propertiesBean.getAnnotation()).isNotNull(); + Bindable target = propertiesBean.asBindTarget(); + assertThat(target.getType()).isEqualTo(ResolvableType.forClass(constructorBindingRecord)); + assertThat(target.getValue()).isNull(); + Constructor bindConstructor = ConfigurationPropertiesBindConstructorProvider.INSTANCE + .getBindConstructor(constructorBindingRecord, false); + assertThat(bindConstructor).isNotNull(); + assertThat(bindConstructor.getParameterTypes()).containsExactly(String.class, Integer.class); + } + @Test void forValueObjectWhenJavaBeanBindTypeThrowsException() { assertThatIllegalStateException() diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java index 7286c7c348ec..82cb5e89f8d0 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ValueObjectBinderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -16,23 +16,35 @@ package org.springframework.boot.context.properties.bind; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; import java.lang.reflect.Constructor; +import java.net.URL; +import java.net.URLClassLoader; import java.nio.file.Path; import java.nio.file.Paths; import java.time.LocalDate; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Objects; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledForJreRange; +import org.junit.jupiter.api.condition.JRE; +import org.junit.jupiter.api.io.TempDir; import org.springframework.boot.context.properties.source.ConfigurationPropertyName; import org.springframework.boot.context.properties.source.ConfigurationPropertySource; import org.springframework.boot.context.properties.source.MockConfigurationPropertySource; +import org.springframework.boot.testsupport.compiler.TestCompiler; import org.springframework.core.ResolvableType; import org.springframework.core.convert.ConversionService; import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.test.util.ReflectionTestUtils; import org.springframework.util.Assert; import static org.assertj.core.api.Assertions.assertThat; @@ -357,6 +369,30 @@ void bindToAnnotationNamedParameter() { assertThat(bound.getImportName()).isEqualTo("test"); } + @Test + @EnabledForJreRange(min = JRE.JAVA_16) + void bindToRecordWithDefaultValue(@TempDir File tempDir) throws IOException, ClassNotFoundException { + MockConfigurationPropertySource source = new MockConfigurationPropertySource(); + source.put("test.record.property1", "value-from-config-1"); + this.sources.add(source); + File recordProperties = new File(tempDir, "RecordProperties.java"); + try (PrintWriter writer = new PrintWriter(new FileWriter(recordProperties))) { + writer.println("public record RecordProperties("); + writer.println( + "@org.springframework.boot.context.properties.bind.DefaultValue(\"default-value-1\") String property1,"); + writer.println( + "@org.springframework.boot.context.properties.bind.DefaultValue(\"default-value-2\") String property2"); + writer.println(") {"); + writer.println("}"); + } + TestCompiler compiler = new TestCompiler(tempDir); + compiler.getTask(Arrays.asList(recordProperties)).call(); + ClassLoader ucl = new URLClassLoader(new URL[] { tempDir.toURI().toURL() }); + Object bean = this.binder.bind("test.record", Class.forName("RecordProperties", true, ucl)).get(); + assertThat(ReflectionTestUtils.getField(bean, "property1")).isEqualTo("value-from-config-1"); + assertThat(ReflectionTestUtils.getField(bean, "property2")).isEqualTo("default-value-2"); + } + private void noConfigurationProperty(BindException ex) { assertThat(ex.getProperty()).isNull(); } From 05b7befc7ae25815be39fb210f97579520e83485 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 29 Mar 2022 15:05:54 +0100 Subject: [PATCH 13/25] Fix javadoc of ResolveMainClassName setClasspath(Object) Closes gh-30468 --- .../boot/gradle/plugin/ResolveMainClassName.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ResolveMainClassName.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ResolveMainClassName.java index 7ca17d55347d..edd8fa710e57 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ResolveMainClassName.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ResolveMainClassName.java @@ -91,8 +91,8 @@ public void setClasspath(FileCollection classpath) { } /** - * Sets the classpath to include in the archive. The given {@code classpath} is - * evaluated as per {@link Project#files(Object...)}. + * Sets the classpath that the task will examine when resolving the main class name. + * The given {@code classpath} is evaluated as per {@link Project#files(Object...)}. * @param classpath the classpath * @since 2.5.10 */ From 7101b5099f8571f42b9c8c23232dd4e1e34b14cd Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Mon, 28 Mar 2022 16:46:48 -0400 Subject: [PATCH 14/25] Make MustacheViewResolver bean back off without Spring MVC See gh-30456 --- .../autoconfigure/mustache/MustacheServletWebConfiguration.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheServletWebConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheServletWebConfiguration.java index 0ff0462802a4..03852a80e807 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheServletWebConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheServletWebConfiguration.java @@ -18,6 +18,7 @@ import com.samskivert.mustache.Mustache.Compiler; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; @@ -29,6 +30,7 @@ @Configuration(proxyBeanMethods = false) @ConditionalOnWebApplication(type = Type.SERVLET) +@ConditionalOnClass(MustacheViewResolver.class) class MustacheServletWebConfiguration { @Bean From 8cb11b74cd706f9934d111150c79cc62fe098916 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 30 Mar 2022 10:33:35 +0100 Subject: [PATCH 15/25] Polish "Make MustacheViewResolver bean back off without Spring MVC" See gh-30456 --- ...heAutoConfigurationWithoutWebMvcTests.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationWithoutWebMvcTests.java diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationWithoutWebMvcTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationWithoutWebMvcTests.java new file mode 100644 index 000000000000..be2a47669ef0 --- /dev/null +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationWithoutWebMvcTests.java @@ -0,0 +1,45 @@ +/* + * Copyright 2012-2022 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.autoconfigure.mustache; + +import com.samskivert.mustache.Mustache; +import org.junit.jupiter.api.Test; + +import org.springframework.boot.autoconfigure.AutoConfigurations; +import org.springframework.boot.test.context.runner.WebApplicationContextRunner; +import org.springframework.boot.testsupport.classpath.ClassPathExclusions; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Tests for {@link MustacheAutoConfiguration} without Spring MVC on the class path. + * + * @author Andy Wilkinson + */ +@ClassPathExclusions("spring-webmvc-*.jar") +class MustacheAutoConfigurationWithoutWebMvcTests { + + @Test + void registerBeansForServletAppWithoutMvc() { + new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(MustacheAutoConfiguration.class)) + .run((context) -> { + assertThat(context).hasSingleBean(Mustache.Compiler.class); + assertThat(context).hasSingleBean(MustacheResourceTemplateLoader.class); + }); + } + +} From 06c5e26f810c46329570c155f198f5e1bfafb747 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 30 Mar 2022 13:30:42 +0100 Subject: [PATCH 16/25] Upgrade to Jackson Bom 2.12.6.20220326 Closes gh-30477 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 75eff4e1ec1f..86ac18ab7c7d 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -539,7 +539,7 @@ bom { ] } } - library("Jackson Bom", "2.12.6") { + library("Jackson Bom", "2.12.6.20220326") { group("com.fasterxml.jackson") { imports = [ "jackson-bom" From 2da44a0b4f32af03ca303bd2de604da9de8685ca Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 30 Mar 2022 14:29:38 +0100 Subject: [PATCH 17/25] Upgrade to Jackson Bom 2.13.2.20220328 Closes gh-30478 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index caa8d3a88b87..83054394e389 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -548,7 +548,7 @@ bom { ] } } - library("Jackson Bom", "2.13.2") { + library("Jackson Bom", "2.13.2.20220328") { group("com.fasterxml.jackson") { imports = [ "jackson-bom" From 6cded5b92871abd2a02ef1c2811efb55c2e13709 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 31 Mar 2022 09:06:19 +0200 Subject: [PATCH 18/25] Upgrade Java 18 version in CI image Closes gh-30488 --- ci/images/get-jdk-url.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/images/get-jdk-url.sh b/ci/images/get-jdk-url.sh index c959027b4ded..4d11c3418e7c 100755 --- a/ci/images/get-jdk-url.sh +++ b/ci/images/get-jdk-url.sh @@ -12,7 +12,7 @@ case "$1" in echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.2%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8.tar.gz" ;; java18) - echo "https://github.com/adoptium/temurin18-binaries/releases/download/jdk18-2022-03-17-09-00-beta/OpenJDK18-jdk_x64_linux_hotspot_2022-03-17-09-00.tar.gz" + echo "https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18%2B36/OpenJDK18U-jdk_x64_linux_hotspot_18_36.tar.gz" ;; *) echo $"Unknown java version" From 2e90fd2302a5272bd18a5c49b5a14decc90d4305 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 31 Mar 2022 09:06:56 +0200 Subject: [PATCH 19/25] Upgrade CI to Docker 20.10.14 Closes gh-30484 --- ci/images/get-docker-url.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/images/get-docker-url.sh b/ci/images/get-docker-url.sh index de0e6326126e..fae9032a9e7f 100755 --- a/ci/images/get-docker-url.sh +++ b/ci/images/get-docker-url.sh @@ -1,5 +1,5 @@ #!/bin/bash set -e -version="20.10.13" +version="20.10.14" echo "https://download.docker.com/linux/static/stable/x86_64/docker-$version.tgz"; From a99fcecd48765fd7e584027e7b367be69c684af8 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 31 Mar 2022 09:07:32 +0200 Subject: [PATCH 20/25] Upgrade Java 18 version in CI image Closes gh-30482 --- ci/images/get-jdk-url.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/images/get-jdk-url.sh b/ci/images/get-jdk-url.sh index c959027b4ded..4d11c3418e7c 100755 --- a/ci/images/get-jdk-url.sh +++ b/ci/images/get-jdk-url.sh @@ -12,7 +12,7 @@ case "$1" in echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.2%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8.tar.gz" ;; java18) - echo "https://github.com/adoptium/temurin18-binaries/releases/download/jdk18-2022-03-17-09-00-beta/OpenJDK18-jdk_x64_linux_hotspot_2022-03-17-09-00.tar.gz" + echo "https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18%2B36/OpenJDK18U-jdk_x64_linux_hotspot_18_36.tar.gz" ;; *) echo $"Unknown java version" From 8409c2f51490182f1b6782ed679a56a9e90a62f4 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 31 Mar 2022 09:08:15 +0200 Subject: [PATCH 21/25] Upgrade CI to Docker 20.10.14 Closes gh-30481 --- ci/images/get-docker-url.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/images/get-docker-url.sh b/ci/images/get-docker-url.sh index de0e6326126e..fae9032a9e7f 100755 --- a/ci/images/get-docker-url.sh +++ b/ci/images/get-docker-url.sh @@ -1,5 +1,5 @@ #!/bin/bash set -e -version="20.10.13" +version="20.10.14" echo "https://download.docker.com/linux/static/stable/x86_64/docker-$version.tgz"; From 94c40c7234d0181073fa63e85db7005682b92a1b Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 31 Mar 2022 11:29:49 +0200 Subject: [PATCH 22/25] Upgrade to Spring Framework 5.3.18 Closes gh-30491 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 86ac18ab7c7d..7e4484cd376b 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1715,7 +1715,7 @@ bom { ] } } - library("Spring Framework", "5.3.17") { + library("Spring Framework", "5.3.18") { group("org.springframework") { imports = [ "spring-framework-bom" From 7ccbdda1e7871387142ab0025b9de26a2c61f9d4 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 31 Mar 2022 11:30:14 +0200 Subject: [PATCH 23/25] Upgrade to Spring Framework 5.3.18 Closes gh-30492 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 83054394e389..e4754063d4a6 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1699,7 +1699,7 @@ bom { ] } } - library("Spring Framework", "5.3.17") { + library("Spring Framework", "5.3.18") { group("org.springframework") { imports = [ "spring-framework-bom" From 17936b855c69e3f202c1a0357fb2ab8167e8785f Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 31 Mar 2022 12:42:37 +0200 Subject: [PATCH 24/25] Polish --- .../boot/autoconfigure/flyway/FlywayPropertiesTests.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayPropertiesTests.java index 7ff514f9000c..0e0c8138304e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -103,8 +103,8 @@ void expectedPropertiesAreManaged() { ignoreProperties(properties, "url", "driverClassName", "user", "password", "enabled", "checkLocation", "createDataSource"); // High level object we can't set with properties - ignoreProperties(configuration, "callbacks", "classLoader", "dataSource", "javaMigrations", - "javaMigrationClassProvider", "resourceProvider", "resolvers"); + ignoreProperties(configuration, "callbacks", "dataSource", "javaMigrations", "javaMigrationClassProvider", + "resourceProvider", "resolvers"); // Properties we don't want to expose ignoreProperties(configuration, "resolversAsClassNames", "callbacksAsClassNames"); // Handled by the conversion service From 25c233f285388f8643bcf8f9a86c7a8f7e5f704c Mon Sep 17 00:00:00 2001 From: Spring Builds Date: Thu, 31 Mar 2022 13:26:14 +0000 Subject: [PATCH 25/25] Release v2.6.6 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index a81b6f9aa1a4..e9bc9e6512d1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=2.6.6-SNAPSHOT +version=2.6.6 org.gradle.caching=true org.gradle.parallel=true