Skip to content

Commit 3f86d76

Browse files
authored
Merge pull request #1717 from spencergibb/next-5.1.x
Updates version to 5.1.0-SNAPSHOT and adds boot 4.2 support
2 parents 83a0a2b + 01c2840 commit 3f86d76

6 files changed

Lines changed: 12 additions & 148 deletions

File tree

spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/CompatibilityVerifierAutoConfiguration.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,4 @@ SpringBootVersionVerifier springBootVersionVerifier(CompatibilityVerifierPropert
5050
return new SpringBootVersionVerifier(properties.getCompatibleBootVersions());
5151
}
5252

53-
@Bean
54-
SleuthPresentVerifier sleuthPresentVerifier() {
55-
return new SleuthPresentVerifier();
56-
}
57-
5853
}

spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/CompatibilityVerifierProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class CompatibilityVerifierProperties {
3737
* the patch version if you don't want to specify a concrete value. Example:
3838
* {@code 3.5.x}
3939
*/
40-
private List<String> compatibleBootVersions = List.of("4.0.x", "4.1.x");
40+
private List<String> compatibleBootVersions = List.of("4.2.x");
4141

4242
public boolean isEnabled() {
4343
return this.enabled;

spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/SleuthPresentVerifier.java

Lines changed: 0 additions & 48 deletions
This file was deleted.

spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/SpringBootVersionVerifier.java

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.cloud.configuration;
1818

19-
import java.time.Duration;
2019
import java.util.HashMap;
2120
import java.util.List;
2221
import java.util.Map;
@@ -25,7 +24,7 @@
2524
import org.apache.commons.logging.LogFactory;
2625

2726
import org.springframework.boot.SpringBootVersion;
28-
import org.springframework.boot.info.ProcessInfo;
27+
import org.springframework.boot.system.ApplicationHome;
2928
import org.springframework.util.StringUtils;
3029

3130
/**
@@ -35,7 +34,7 @@ class SpringBootVersionVerifier implements CompatibilityVerifier {
3534

3635
private static final Log log = LogFactory.getLog(SpringBootVersionVerifier.class);
3736

38-
final Map<String, CompatibilityPredicate> ACCEPTED_VERSIONS = new HashMap<>(Map.of("4.0", is4_0(), "4.1", is4_1()));
37+
final Map<String, CompatibilityPredicate> ACCEPTED_VERSIONS = new HashMap<>(Map.of("4.2", is4_2()));
3938

4039
private final List<String> acceptedVersions;
4140

@@ -68,39 +67,18 @@ String getVersionFromManifest() {
6867
return SpringBootVersion.getVersion();
6968
}
7069

71-
CompatibilityPredicate is4_0() {
70+
CompatibilityPredicate is4_2() {
7271
return new CompatibilityPredicate() {
7372

7473
@Override
7574
public String toString() {
76-
return "Predicate for Boot 4.0";
75+
return "Predicate for Boot 4.2";
7776
}
7877

7978
@Override
8079
public boolean isCompatible() {
8180
try {
82-
Class.forName("org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty");
83-
return true;
84-
}
85-
catch (ClassNotFoundException e) {
86-
return false;
87-
}
88-
}
89-
};
90-
}
91-
92-
CompatibilityPredicate is4_1() {
93-
return new CompatibilityPredicate() {
94-
95-
@Override
96-
public String toString() {
97-
return "Predicate for Boot 4.1";
98-
}
99-
100-
@Override
101-
public boolean isCompatible() {
102-
try {
103-
ProcessInfo.class.getMethod("getUptime", Duration.class);
81+
ApplicationHome.class.getMethod("getSourcePath");
10482
return true;
10583
}
10684
catch (NoSuchMethodException e) {

spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SleuthPresentVerifierTests.java

Lines changed: 0 additions & 49 deletions
This file was deleted.

spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SpringBootDependencyTests.java

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,8 @@ String getVersionFromManifest() {
176176

177177
@Test
178178
public void should_match_against_current_manifest() {
179-
try {
180-
verifyCurrentVersionFromManifest("4.0");
181-
verifyCurrentVersionFromManifest("4.0.x");
182-
}
183-
catch (AssertionError e) {
184-
if (e.getMessage() != null && e.getMessage().contains("4.1.")) {
185-
// we're likely running a boot 4.1 compatibility test, try 4.1
186-
verifyCurrentVersionFromManifest("4.1");
187-
verifyCurrentVersionFromManifest("4.1.x");
188-
}
189-
else {
190-
throw e;
191-
}
192-
}
179+
verifyCurrentVersionFromManifest("4.2");
180+
verifyCurrentVersionFromManifest("4.2.x");
193181
}
194182

195183
private void verifyCurrentVersionFromManifest(String version) {
@@ -205,15 +193,15 @@ private void verifyCurrentVersionFromManifest(String version) {
205193

206194
@Test
207195
public void should_match_against_current_predicate() {
208-
List<String> acceptedVersions = Collections.singletonList("4.0");
196+
List<String> acceptedVersions = Collections.singletonList("4.2");
209197
SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions) {
210198
@Override
211199
String getVersionFromManifest() {
212200
return "";
213201
}
214202
};
215203
versionVerifier.ACCEPTED_VERSIONS.clear();
216-
versionVerifier.ACCEPTED_VERSIONS.put("4.0", versionVerifier.is4_0());
204+
versionVerifier.ACCEPTED_VERSIONS.put("4.2", versionVerifier.is4_2());
217205

218206
VerificationResult verificationResult = versionVerifier.verify();
219207

@@ -223,15 +211,15 @@ String getVersionFromManifest() {
223211

224212
@Test
225213
public void should_match_against_current_predicate_with_version_ending_with_x() {
226-
List<String> acceptedVersions = Collections.singletonList("4.0.x");
214+
List<String> acceptedVersions = Collections.singletonList("4.2.x");
227215
SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions) {
228216
@Override
229217
String getVersionFromManifest() {
230218
return "";
231219
}
232220
};
233221
versionVerifier.ACCEPTED_VERSIONS.clear();
234-
versionVerifier.ACCEPTED_VERSIONS.put("4.0", versionVerifier.is4_0());
222+
versionVerifier.ACCEPTED_VERSIONS.put("4.2", versionVerifier.is4_2());
235223

236224
VerificationResult verificationResult = versionVerifier.verify();
237225

0 commit comments

Comments
 (0)