Adds boot 3.1 support in SpringBootVersionVerifier
This commit is contained in:
@@ -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<String> compatibleBootVersions = List.of("3.0.x");
|
||||
private List<String> compatibleBootVersions = List.of("3.0.x", "3.1.x");
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.enabled;
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.boot.SpringBootVersion;
|
||||
import org.springframework.boot.autoconfigure.validation.ValidationConfigurationCustomizer;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -36,6 +37,7 @@ class SpringBootVersionVerifier implements CompatibilityVerifier {
|
||||
final Map<String, CompatibilityPredicate> ACCEPTED_VERSIONS = new HashMap<>() {
|
||||
{
|
||||
this.put("3.0", is3_0());
|
||||
this.put("3.1", is3_1());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -95,6 +97,30 @@ class SpringBootVersionVerifier implements CompatibilityVerifier {
|
||||
};
|
||||
}
|
||||
|
||||
CompatibilityPredicate is3_1() {
|
||||
return new CompatibilityPredicate() {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Predicate for Boot 3.1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompatible() {
|
||||
try {
|
||||
// since 3.1
|
||||
ValidationConfigurationCustomizer.class.getMethod("setIgnoreRegistrationFailure", boolean.class);
|
||||
return true;
|
||||
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private String errorDescription() {
|
||||
String versionFromManifest = getVersionFromManifest();
|
||||
if (StringUtils.hasText(versionFromManifest)) {
|
||||
|
||||
Reference in New Issue
Block a user