Updates for boot 2.2.x
This commit is contained in:
@@ -17,7 +17,9 @@
|
||||
package org.springframework.cloud.client.discovery.health;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.health.CompositeHealthIndicator;
|
||||
@@ -39,18 +41,27 @@ public class DiscoveryCompositeHealthIndicator extends CompositeHealthIndicator
|
||||
@Autowired
|
||||
public DiscoveryCompositeHealthIndicator(HealthAggregator healthAggregator,
|
||||
List<DiscoveryHealthIndicator> indicators) {
|
||||
super(healthAggregator);
|
||||
for (DiscoveryHealthIndicator indicator : indicators) {
|
||||
Holder holder = new Holder(indicator);
|
||||
addHealthIndicator(indicator.getName(), holder);
|
||||
this.healthIndicators.add(holder);
|
||||
}
|
||||
super(healthAggregator, createMap(indicators));
|
||||
getRegistry().getAll().values().stream()
|
||||
.filter(healthIndicator -> healthIndicator instanceof Holder)
|
||||
.forEach(healthIndicator -> this.healthIndicators
|
||||
.add((Holder) healthIndicator));
|
||||
}
|
||||
|
||||
public ArrayList<Holder> getHealthIndicators() {
|
||||
return this.healthIndicators;
|
||||
}
|
||||
|
||||
public static Map<String, HealthIndicator> createMap(
|
||||
List<DiscoveryHealthIndicator> indicators) {
|
||||
Map<String, HealthIndicator> map = new HashMap<>();
|
||||
for (DiscoveryHealthIndicator indicator : indicators) {
|
||||
Holder holder = new Holder(indicator);
|
||||
map.put(indicator.getName(), holder);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Holder for the Health Indicator.
|
||||
*/
|
||||
|
||||
@@ -39,6 +39,7 @@ class SpringBootVersionVerifier implements CompatibilityVerifier {
|
||||
this.put("1.5", is1_5());
|
||||
this.put("2.0", is2_0());
|
||||
this.put("2.1", is2_1());
|
||||
this.put("2.2", is2_2());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -137,6 +138,30 @@ class SpringBootVersionVerifier implements CompatibilityVerifier {
|
||||
};
|
||||
}
|
||||
|
||||
CompatibilityPredicate is2_2() {
|
||||
return new CompatibilityPredicate() {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Predicate for Boot 2.2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompatible() {
|
||||
try {
|
||||
// since 2.1
|
||||
Class.forName(
|
||||
"org.springframework.boot.autoconfigure.flyway.FlywayMigrationScriptMissingException");
|
||||
return true;
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private String errorDescription() {
|
||||
String versionFromManifest = getVersionFromManifest();
|
||||
if (StringUtils.hasText(versionFromManifest)) {
|
||||
|
||||
@@ -144,7 +144,7 @@ public class SpringBootDependencyTests {
|
||||
|
||||
@Test
|
||||
public void should_match_against_current_manifest() {
|
||||
List<String> acceptedVersions = Collections.singletonList("2.1");
|
||||
List<String> acceptedVersions = Collections.singletonList("2.2");
|
||||
SpringBootVersionVerifier versionVerifier = new SpringBootVersionVerifier(
|
||||
acceptedVersions);
|
||||
versionVerifier.ACCEPTED_VERSIONS.clear();
|
||||
|
||||
@@ -28,7 +28,7 @@ import static org.springframework.boot.WebApplicationType.NONE;
|
||||
|
||||
/**
|
||||
* Integration tests for Bootstrap Listener's functionality of adding a bootstrap context
|
||||
* as the root Application Context
|
||||
* as the root Application Context.
|
||||
*
|
||||
* @author Biju Kunjummen
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user