Updated SpringBootVersionVerifier to require boot 2.6
This commit is contained in:
10
pom.xml
10
pom.xml
@@ -155,6 +155,16 @@
|
||||
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||
<version>${spring-security-oauth2-autoconfigure.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
@@ -37,7 +37,7 @@ public class CompatibilityVerifierProperties {
|
||||
* the patch version if you don't want to specify a concrete value. Example:
|
||||
* {@code 3.4.x}
|
||||
*/
|
||||
private List<String> compatibleBootVersions = Arrays.asList("2.4.x", "2.5.x");
|
||||
private List<String> compatibleBootVersions = Arrays.asList("2.6.x");
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.enabled;
|
||||
|
||||
@@ -35,8 +35,7 @@ class SpringBootVersionVerifier implements CompatibilityVerifier {
|
||||
|
||||
final Map<String, CompatibilityPredicate> ACCEPTED_VERSIONS = new HashMap<String, CompatibilityPredicate>() {
|
||||
{
|
||||
this.put("2.4", is2_4());
|
||||
this.put("2.5", is2_5());
|
||||
this.put("2.6", is2_6());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -71,42 +70,19 @@ class SpringBootVersionVerifier implements CompatibilityVerifier {
|
||||
return SpringBootVersion.getVersion();
|
||||
}
|
||||
|
||||
CompatibilityPredicate is2_4() {
|
||||
CompatibilityPredicate is2_6() {
|
||||
return new CompatibilityPredicate() {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Predicate for Boot 2.4";
|
||||
return "Predicate for Boot 2.6";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompatible() {
|
||||
try {
|
||||
// since 2.4
|
||||
Class.forName("org.springframework.boot.Bootstrapper");
|
||||
return true;
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
CompatibilityPredicate is2_5() {
|
||||
return new CompatibilityPredicate() {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Predicate for Boot 2.5";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompatible() {
|
||||
try {
|
||||
// since 2.4
|
||||
Class.forName("org.springframework.boot.context.properties.bind.Bindable.BindRestriction");
|
||||
// since 2.6
|
||||
Class.forName("org.springframework.boot.autoconfigure.data.redis.ClientResourcesBuilderCustomizer");
|
||||
return true;
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
|
||||
@@ -176,14 +176,14 @@ public class SpringBootDependencyTests {
|
||||
@Test
|
||||
public void should_match_against_current_manifest() {
|
||||
try {
|
||||
verifyCurrentVersionFromManifest("2.4");
|
||||
verifyCurrentVersionFromManifest("2.4.x");
|
||||
verifyCurrentVersionFromManifest("2.6");
|
||||
verifyCurrentVersionFromManifest("2.6.x");
|
||||
}
|
||||
catch (AssertionError e) {
|
||||
if (e.getMessage() != null && e.getMessage().contains("2.5.")) {
|
||||
// we're likely running a boot 2.5 compatibility test, try 2.5
|
||||
verifyCurrentVersionFromManifest("2.5");
|
||||
verifyCurrentVersionFromManifest("2.5.x");
|
||||
if (e.getMessage() != null && e.getMessage().contains("2.7.")) {
|
||||
// we're likely running a boot 2.7 compatibility test, try 2.7
|
||||
verifyCurrentVersionFromManifest("2.7");
|
||||
verifyCurrentVersionFromManifest("2.7.x");
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
@@ -204,7 +204,7 @@ public class SpringBootDependencyTests {
|
||||
|
||||
@Test
|
||||
public void should_match_against_current_predicate() {
|
||||
List<String> acceptedVersions = Collections.singletonList("2.4");
|
||||
List<String> acceptedVersions = Collections.singletonList("2.6");
|
||||
SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions) {
|
||||
@Override
|
||||
String getVersionFromManifest() {
|
||||
@@ -212,7 +212,7 @@ public class SpringBootDependencyTests {
|
||||
}
|
||||
};
|
||||
versionVerifier.ACCEPTED_VERSIONS.clear();
|
||||
versionVerifier.ACCEPTED_VERSIONS.put("2.4", versionVerifier.is2_4());
|
||||
versionVerifier.ACCEPTED_VERSIONS.put("2.6", versionVerifier.is2_6());
|
||||
|
||||
VerificationResult verificationResult = versionVerifier.verify();
|
||||
|
||||
@@ -222,7 +222,7 @@ public class SpringBootDependencyTests {
|
||||
|
||||
@Test
|
||||
public void should_match_against_current_predicate_with_version_ending_with_x() {
|
||||
List<String> acceptedVersions = Collections.singletonList("2.4.x");
|
||||
List<String> acceptedVersions = Collections.singletonList("2.6.x");
|
||||
SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(acceptedVersions) {
|
||||
@Override
|
||||
String getVersionFromManifest() {
|
||||
@@ -230,7 +230,7 @@ public class SpringBootDependencyTests {
|
||||
}
|
||||
};
|
||||
versionVerifier.ACCEPTED_VERSIONS.clear();
|
||||
versionVerifier.ACCEPTED_VERSIONS.put("2.4", versionVerifier.is2_4());
|
||||
versionVerifier.ACCEPTED_VERSIONS.put("2.6", versionVerifier.is2_6());
|
||||
|
||||
VerificationResult verificationResult = versionVerifier.verify();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user