From bf7ddb17f581c9130318e7e945d0e952ba9387bb Mon Sep 17 00:00:00 2001 From: spencergibb Date: Mon, 5 Aug 2024 13:21:35 -0400 Subject: [PATCH] Adds support for boot 3.4 --- .../CompatibilityVerifierProperties.java | 2 +- .../SpringBootVersionVerifier.java | 28 ++----------------- .../SpringBootDependencyTests.java | 24 ++++++++-------- 3 files changed, 16 insertions(+), 38 deletions(-) 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 cbcfa50c1..97ae7d2df 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 @@ -36,7 +36,7 @@ public class CompatibilityVerifierProperties { * the patch version if you don't want to specify a concrete value. Example: * {@code 3.4.x} */ - private List compatibleBootVersions = List.of("3.2.x", "3.3.x"); + private List compatibleBootVersions = List.of("3.4.x"); public boolean isEnabled() { return this.enabled; 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 691a957ab..6da9c9bfc 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 @@ -35,8 +35,7 @@ class SpringBootVersionVerifier implements CompatibilityVerifier { final Map ACCEPTED_VERSIONS = new HashMap<>() { { - this.put("3.2", is3_2()); - this.put("3.3", is3_3()); + this.put("3.4", is3_4()); } }; @@ -71,12 +70,12 @@ String getVersionFromManifest() { return SpringBootVersion.getVersion(); } - CompatibilityPredicate is3_2() { + CompatibilityPredicate is3_4() { return new CompatibilityPredicate() { @Override public String toString() { - return "Predicate for Boot 3.2"; + return "Predicate for Boot 3.4"; } @Override @@ -92,27 +91,6 @@ public boolean isCompatible() { }; } - CompatibilityPredicate is3_3() { - return new CompatibilityPredicate() { - - @Override - public String toString() { - return "Predicate for Boot 3.3"; - } - - @Override - public boolean isCompatible() { - try { - Class.forName("org.springframework.boot.autoconfigure.ldap.PropertiesLdapConnectionDetails"); - return true; - } - catch (ClassNotFoundException e) { - return false; - } - } - }; - } - private String errorDescription() { String versionFromManifest = getVersionFromManifest(); if (StringUtils.hasText(versionFromManifest)) { 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 d50ed4128..cef25841d 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,18 +176,18 @@ String getVersionFromManifest() { @Test public void should_match_against_current_manifest() { try { - verifyCurrentVersionFromManifest("3.2"); - verifyCurrentVersionFromManifest("3.2.x"); + verifyCurrentVersionFromManifest("3.4"); + verifyCurrentVersionFromManifest("3.4.x"); } catch (AssertionError e) { - if (e.getMessage() != null && e.getMessage().contains("3.3.")) { - // we're likely running a boot 3.3 compatibility test, try 3.3 - verifyCurrentVersionFromManifest("3.3"); - verifyCurrentVersionFromManifest("3.3.x"); - } - else { - throw e; - } + // if (e.getMessage() != null && e.getMessage().contains("3.3.")) { + // // we're likely running a boot 3.3 compatibility test, try 3.3 + // verifyCurrentVersionFromManifest("3.3"); + // verifyCurrentVersionFromManifest("3.3.x"); + // } + // else { + throw e; + // } } } @@ -212,7 +212,7 @@ String getVersionFromManifest() { } }; versionVerifier.ACCEPTED_VERSIONS.clear(); - versionVerifier.ACCEPTED_VERSIONS.put("3.0", versionVerifier.is3_2()); + versionVerifier.ACCEPTED_VERSIONS.put("3.0", versionVerifier.is3_4()); VerificationResult verificationResult = versionVerifier.verify(); @@ -230,7 +230,7 @@ String getVersionFromManifest() { } }; versionVerifier.ACCEPTED_VERSIONS.clear(); - versionVerifier.ACCEPTED_VERSIONS.put("3.0", versionVerifier.is3_2()); + versionVerifier.ACCEPTED_VERSIONS.put("3.0", versionVerifier.is3_4()); VerificationResult verificationResult = versionVerifier.verify();