From ae7c3bef0f1d79683251e464a595cc6b2dc674fb Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Thu, 6 Aug 2026 14:58:17 -0400 Subject: [PATCH] Updates version to 5.1.0-SNAPSHOT Updates build version to 5.1.0-SNAPSHOT Adds compatibility to boot 4.2.x --- docs/pom.xml | 2 +- pom.xml | 4 +- spring-cloud-commons-dependencies/pom.xml | 4 +- spring-cloud-commons/pom.xml | 2 +- ...ompatibilityVerifierAutoConfiguration.java | 5 -- .../CompatibilityVerifierProperties.java | 2 +- .../configuration/SleuthPresentVerifier.java | 48 ------------------ .../SpringBootVersionVerifier.java | 32 ++---------- .../SleuthPresentVerifierTests.java | 49 ------------------- .../SpringBootDependencyTests.java | 24 +++------ .../pom.xml | 2 +- .../pom.xml | 2 +- spring-cloud-context/pom.xml | 2 +- spring-cloud-loadbalancer/pom.xml | 2 +- spring-cloud-starter-bootstrap/pom.xml | 2 +- spring-cloud-starter-loadbalancer/pom.xml | 2 +- spring-cloud-starter/pom.xml | 2 +- spring-cloud-test-support/pom.xml | 2 +- 18 files changed, 26 insertions(+), 162 deletions(-) delete mode 100644 spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/SleuthPresentVerifier.java delete mode 100644 spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SleuthPresentVerifierTests.java diff --git a/docs/pom.xml b/docs/pom.xml index 1703a5f18..f9a62e299 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -8,7 +8,7 @@ org.springframework.cloud spring-cloud-commons-parent - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT jar Spring Cloud Commons Docs diff --git a/pom.xml b/pom.xml index 7fb927da2..5309d5056 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.springframework.cloud spring-cloud-commons-parent - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT pom Spring Cloud Commons Parent Spring Cloud Commons Parent @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-build - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT diff --git a/spring-cloud-commons-dependencies/pom.xml b/spring-cloud-commons-dependencies/pom.xml index e054ad7ce..d57607081 100644 --- a/spring-cloud-commons-dependencies/pom.xml +++ b/spring-cloud-commons-dependencies/pom.xml @@ -6,11 +6,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT spring-cloud-commons-dependencies - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT pom spring-cloud-commons-dependencies Spring Cloud Commons Dependencies diff --git a/spring-cloud-commons/pom.xml b/spring-cloud-commons/pom.xml index bc9c44724..1bc4fb875 100644 --- a/spring-cloud-commons/pom.xml +++ b/spring-cloud-commons/pom.xml @@ -7,7 +7,7 @@ org.springframework.cloud spring-cloud-commons-parent - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT .. spring-cloud-commons diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/CompatibilityVerifierAutoConfiguration.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/CompatibilityVerifierAutoConfiguration.java index 4708f6c00..b9258eedc 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/CompatibilityVerifierAutoConfiguration.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/CompatibilityVerifierAutoConfiguration.java @@ -50,9 +50,4 @@ SpringBootVersionVerifier springBootVersionVerifier(CompatibilityVerifierPropert return new SpringBootVersionVerifier(properties.getCompatibleBootVersions()); } - @Bean - SleuthPresentVerifier sleuthPresentVerifier() { - return new SleuthPresentVerifier(); - } - } diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/CompatibilityVerifierProperties.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/CompatibilityVerifierProperties.java index 9a2abf4d2..660607b44 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/CompatibilityVerifierProperties.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/CompatibilityVerifierProperties.java @@ -37,7 +37,7 @@ public class CompatibilityVerifierProperties { * the patch version if you don't want to specify a concrete value. Example: * {@code 3.5.x} */ - private List compatibleBootVersions = List.of("4.0.x", "4.1.x"); + private List compatibleBootVersions = List.of("4.2.x"); public boolean isEnabled() { return this.enabled; diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/SleuthPresentVerifier.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/SleuthPresentVerifier.java deleted file mode 100644 index c60d9b502..000000000 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/SleuthPresentVerifier.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2012-present 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.cloud.configuration; - -import org.springframework.util.ClassUtils; - -/** - * Verifies if Spring Cloud Sleuth is present on the classpath. - */ -class SleuthPresentVerifier implements CompatibilityVerifier { - - private static final String TRACER_CLASS = "org.springframework.cloud.sleuth.Tracer"; - - private static final String ERROR_DESCRIPTION = "Spring Cloud Sleuth is not compatible with this Spring Cloud release train"; - - private static final String ACTION = """ - Migrate from Spring Cloud Sleuth to Micrometer Tracing . - You can check the Sleuth 3.1 Migration Guide over here [https://github.com/micrometer-metrics/tracing/wiki/Spring-Cloud-Sleuth-3.1-Migration-Guide].\s - If you want to disable this check, just set the property [spring.cloud.compatibility-verifier.enabled=false]"""; - - @Override - public VerificationResult verify() { - boolean present = sleuthPresent(); - if (!present) { - return VerificationResult.compatible(); - } - return VerificationResult.notCompatible(ERROR_DESCRIPTION, ACTION); - } - - boolean sleuthPresent() { - return ClassUtils.isPresent(TRACER_CLASS, null); - } - -} diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/SpringBootVersionVerifier.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/SpringBootVersionVerifier.java index e933c454b..bbb5bf683 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/SpringBootVersionVerifier.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/SpringBootVersionVerifier.java @@ -16,7 +16,6 @@ package org.springframework.cloud.configuration; -import java.time.Duration; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,7 +24,7 @@ import org.apache.commons.logging.LogFactory; import org.springframework.boot.SpringBootVersion; -import org.springframework.boot.info.ProcessInfo; +import org.springframework.boot.system.ApplicationHome; import org.springframework.util.StringUtils; /** @@ -35,7 +34,7 @@ class SpringBootVersionVerifier implements CompatibilityVerifier { private static final Log log = LogFactory.getLog(SpringBootVersionVerifier.class); - final Map ACCEPTED_VERSIONS = new HashMap<>(Map.of("4.0", is4_0(), "4.1", is4_1())); + final Map ACCEPTED_VERSIONS = new HashMap<>(Map.of("4.2", is4_2())); private final List acceptedVersions; @@ -68,39 +67,18 @@ String getVersionFromManifest() { return SpringBootVersion.getVersion(); } - CompatibilityPredicate is4_0() { + CompatibilityPredicate is4_2() { return new CompatibilityPredicate() { @Override public String toString() { - return "Predicate for Boot 4.0"; + return "Predicate for Boot 4.2"; } @Override public boolean isCompatible() { try { - Class.forName("org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty"); - return true; - } - catch (ClassNotFoundException e) { - return false; - } - } - }; - } - - CompatibilityPredicate is4_1() { - return new CompatibilityPredicate() { - - @Override - public String toString() { - return "Predicate for Boot 4.1"; - } - - @Override - public boolean isCompatible() { - try { - ProcessInfo.class.getMethod("getUptime", Duration.class); + ApplicationHome.class.getMethod("getSourcePath"); return true; } catch (NoSuchMethodException e) { diff --git a/spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SleuthPresentVerifierTests.java b/spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SleuthPresentVerifierTests.java deleted file mode 100644 index 4b3369fe9..000000000 --- a/spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SleuthPresentVerifierTests.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2012-present 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.cloud.configuration; - -import org.assertj.core.api.BDDAssertions; -import org.junit.jupiter.api.Test; - -class SleuthPresentVerifierTests { - - @Test - void should_be_compatible_when_sleuth_is_not_on_the_classpath() { - VerificationResult verify = new SleuthPresentVerifier() { - @Override - boolean sleuthPresent() { - return false; - } - }.verify(); - - BDDAssertions.then(verify.isNotCompatible()).isFalse(); - } - - @Test - void should_not_be_compatible_when_sleuth_is_on_the_classpath() { - VerificationResult verify = new SleuthPresentVerifier() { - @Override - boolean sleuthPresent() { - return true; - } - }.verify(); - - BDDAssertions.then(verify.isNotCompatible()).isTrue(); - - } - -} diff --git a/spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SpringBootDependencyTests.java b/spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SpringBootDependencyTests.java index 3317750ef..49cc68868 100644 --- a/spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SpringBootDependencyTests.java +++ b/spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SpringBootDependencyTests.java @@ -176,20 +176,8 @@ String getVersionFromManifest() { @Test public void should_match_against_current_manifest() { - try { - verifyCurrentVersionFromManifest("4.0"); - verifyCurrentVersionFromManifest("4.0.x"); - } - catch (AssertionError e) { - if (e.getMessage() != null && e.getMessage().contains("4.1.")) { - // we're likely running a boot 4.1 compatibility test, try 4.1 - verifyCurrentVersionFromManifest("4.1"); - verifyCurrentVersionFromManifest("4.1.x"); - } - else { - throw e; - } - } + verifyCurrentVersionFromManifest("4.2"); + verifyCurrentVersionFromManifest("4.2.x"); } private void verifyCurrentVersionFromManifest(String version) { @@ -205,7 +193,7 @@ private void verifyCurrentVersionFromManifest(String version) { @Test public void should_match_against_current_predicate() { - List acceptedVersions = Collections.singletonList("4.0"); + List acceptedVersions = Collections.singletonList("4.2"); SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions) { @Override String getVersionFromManifest() { @@ -213,7 +201,7 @@ String getVersionFromManifest() { } }; versionVerifier.ACCEPTED_VERSIONS.clear(); - versionVerifier.ACCEPTED_VERSIONS.put("4.0", versionVerifier.is4_0()); + versionVerifier.ACCEPTED_VERSIONS.put("4.2", versionVerifier.is4_2()); VerificationResult verificationResult = versionVerifier.verify(); @@ -223,7 +211,7 @@ String getVersionFromManifest() { @Test public void should_match_against_current_predicate_with_version_ending_with_x() { - List acceptedVersions = Collections.singletonList("4.0.x"); + List acceptedVersions = Collections.singletonList("4.2.x"); SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions) { @Override String getVersionFromManifest() { @@ -231,7 +219,7 @@ String getVersionFromManifest() { } }; versionVerifier.ACCEPTED_VERSIONS.clear(); - versionVerifier.ACCEPTED_VERSIONS.put("4.0", versionVerifier.is4_0()); + versionVerifier.ACCEPTED_VERSIONS.put("4.2", versionVerifier.is4_2()); VerificationResult verificationResult = versionVerifier.verify(); diff --git a/spring-cloud-context-integration-tests/pom.xml b/spring-cloud-context-integration-tests/pom.xml index caf4075b0..51ccea2c5 100644 --- a/spring-cloud-context-integration-tests/pom.xml +++ b/spring-cloud-context-integration-tests/pom.xml @@ -7,7 +7,7 @@ org.springframework.cloud spring-cloud-commons-parent - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT .. spring-cloud-context-integration-tests diff --git a/spring-cloud-context-webflux-integration-tests/pom.xml b/spring-cloud-context-webflux-integration-tests/pom.xml index 797aef61b..7675f49d1 100644 --- a/spring-cloud-context-webflux-integration-tests/pom.xml +++ b/spring-cloud-context-webflux-integration-tests/pom.xml @@ -7,7 +7,7 @@ org.springframework.cloud spring-cloud-commons-parent - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT .. spring-cloud-context-webflux-integration-tests diff --git a/spring-cloud-context/pom.xml b/spring-cloud-context/pom.xml index ded155110..16c5d4d80 100644 --- a/spring-cloud-context/pom.xml +++ b/spring-cloud-context/pom.xml @@ -7,7 +7,7 @@ org.springframework.cloud spring-cloud-commons-parent - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT .. spring-cloud-context diff --git a/spring-cloud-loadbalancer/pom.xml b/spring-cloud-loadbalancer/pom.xml index ca71532ec..502694fa0 100644 --- a/spring-cloud-loadbalancer/pom.xml +++ b/spring-cloud-loadbalancer/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-commons-parent - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT .. spring-cloud-loadbalancer diff --git a/spring-cloud-starter-bootstrap/pom.xml b/spring-cloud-starter-bootstrap/pom.xml index 78750157d..616ec8e13 100644 --- a/spring-cloud-starter-bootstrap/pom.xml +++ b/spring-cloud-starter-bootstrap/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-commons-parent - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT .. jar diff --git a/spring-cloud-starter-loadbalancer/pom.xml b/spring-cloud-starter-loadbalancer/pom.xml index 91a917264..ee0666647 100644 --- a/spring-cloud-starter-loadbalancer/pom.xml +++ b/spring-cloud-starter-loadbalancer/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-commons-parent - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT .. 4.0.0 diff --git a/spring-cloud-starter/pom.xml b/spring-cloud-starter/pom.xml index 032ba6c24..61d24cad2 100644 --- a/spring-cloud-starter/pom.xml +++ b/spring-cloud-starter/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-commons-parent - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT spring-cloud-starter spring-cloud-starter diff --git a/spring-cloud-test-support/pom.xml b/spring-cloud-test-support/pom.xml index 21e4487ce..de62a0349 100644 --- a/spring-cloud-test-support/pom.xml +++ b/spring-cloud-test-support/pom.xml @@ -7,7 +7,7 @@ org.springframework.cloud spring-cloud-commons-parent - 5.0.3-SNAPSHOT + 5.1.0-SNAPSHOT .. spring-cloud-test-support