Browse Source

Updates for boot 2.2.x

pull/490/head
Spencer Gibb 6 years ago
parent
commit
d3dcabb480
No known key found for this signature in database
GPG Key ID: 7788A47380690861
  1. 23
      spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/health/DiscoveryCompositeHealthIndicator.java
  2. 25
      spring-cloud-commons/src/main/java/org/springframework/cloud/configuration/SpringBootVersionVerifier.java
  3. 2
      spring-cloud-commons/src/test/java/org/springframework/cloud/configuration/SpringBootDependencyTests.java
  4. 2
      spring-cloud-context/src/test/java/org/springframework/cloud/bootstrap/config/BootstrapListenerHierarchyIntegrationTests.java

23
spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/health/DiscoveryCompositeHealthIndicator.java

@ -17,7 +17,9 @@ @@ -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 @@ -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.
*/

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

@ -39,6 +39,7 @@ class SpringBootVersionVerifier implements CompatibilityVerifier { @@ -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 { @@ -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)) {

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

@ -144,7 +144,7 @@ public class SpringBootDependencyTests { @@ -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();

2
spring-cloud-context/src/test/java/org/springframework/cloud/bootstrap/config/BootstrapListenerHierarchyIntegrationTests.java

@ -28,7 +28,7 @@ import static org.springframework.boot.WebApplicationType.NONE; @@ -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
*/

Loading…
Cancel
Save