help tooling detect which versions to use
Co-authored-by: Daniel Garnier-Moiroux <git@garnier.wf> Enhance SpringBootVersionResolver [issue] Make this package-protected ; you don't want this class to be a part of your public API (same as MapMapper). [suggestion] set the default value for forcedVersion to -1, it's a usual convention for "this is invalid". Co-authored-by: Daniel Garnier-Moiroux <git@garnier.wf>
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
<description>Test project to verify Spring Cloud Bindings works properly with Spring Boot 2</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<spring-boot.version>2.5.14</spring-boot.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
<description>Test project to verify Spring Cloud Bindings works properly with Spring Boot 2</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<spring-boot.version>3.0.2</spring-boot.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
@@ -2,19 +2,19 @@ package org.springframework.cloud.bindings.boot;
|
||||
|
||||
import org.springframework.boot.SpringBootVersion;
|
||||
|
||||
public class SpringBootVersionResolver {
|
||||
class SpringBootVersionResolver {
|
||||
|
||||
private int forcedVersion;
|
||||
private int forcedVersion = -1;
|
||||
|
||||
public SpringBootVersionResolver() {
|
||||
SpringBootVersionResolver() {
|
||||
}
|
||||
|
||||
protected SpringBootVersionResolver(int forcedVersion) {
|
||||
this.forcedVersion = forcedVersion;
|
||||
}
|
||||
|
||||
public boolean isBootMajorVersionEnabled(int bootVersion) {
|
||||
if (forcedVersion != 0) {
|
||||
protected boolean isBootMajorVersionEnabled(int bootVersion) {
|
||||
if (forcedVersion != -1) {
|
||||
return forcedVersion == bootVersion;
|
||||
}
|
||||
int major = Integer.parseInt(SpringBootVersion.getVersion().split("\\.")[0]);
|
||||
|
||||
Reference in New Issue
Block a user