diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java index 065db289450..2dcf0ffd4a6 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java @@ -27,7 +27,7 @@ import org.springframework.util.Assert; /** * {@link Endpoint} to expose application health. - * + * * @author Dave Syer * @author Christian Dupuis */ @@ -46,17 +46,12 @@ public class HealthEndpoint extends AbstractEndpoint { Assert.notNull(healthAggregator, "HealthAggregator must not be null"); Assert.notNull(healthIndicators, "HealthIndicators must not be null"); - if (healthIndicators.size() == 1) { - this.healthIndicator = healthIndicators.values().iterator().next(); - } - else { - CompositeHealthIndicator healthIndicator = new CompositeHealthIndicator( - healthAggregator); - for (Map.Entry h : healthIndicators.entrySet()) { - healthIndicator.addHealthIndicator(getKey(h.getKey()), h.getValue()); - } - this.healthIndicator = healthIndicator; + CompositeHealthIndicator healthIndicator = new CompositeHealthIndicator( + healthAggregator); + for (Map.Entry h : healthIndicators.entrySet()) { + healthIndicator.addHealthIndicator(getKey(h.getKey()), h.getValue()); } + this.healthIndicator = healthIndicator; } /** diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java index 08b19fa8234..bdd2a7f3399 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java @@ -49,7 +49,7 @@ import static org.junit.Assert.assertTrue; /** * Tests for {@link EndpointAutoConfiguration}. - * + * * @author Dave Syer * @author Phillip Webb * @author Greg Turnquist @@ -89,7 +89,7 @@ public class EndpointAutoConfigurationTests { assertNotNull(bean); Health result = bean.invoke(); assertNotNull(result); - assertTrue("Wrong result: " + result, result.getDetails().containsKey("database")); + assertTrue("Wrong result: " + result, result.getDetails().containsKey("db")); } @Test