mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Rename VanillaHealthIndicator to Application...
Rename `VanillaHealthIndicator` to `ApplicationHealthIndicator` and changed the exposed bean name from `statusHealthIndicator` to `applicationHealthIndicator`. This provides less confusing JSON output: {"status":"UP","application":{"status":"UP"}} vs: {"status":"UP","status":{"status":"UP"}} Fixes gh-1291
This commit is contained in:
parent
d089685935
commit
7d0a3ddcce
@ -34,7 +34,7 @@ import org.springframework.boot.actuate.health.OrderedHealthAggregator;
|
||||
import org.springframework.boot.actuate.health.RabbitHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.RedisHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.SolrHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.VanillaHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@ -81,8 +81,8 @@ public class HealthIndicatorAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(HealthIndicator.class)
|
||||
public HealthIndicator statusHealthIndicator() {
|
||||
return new VanillaHealthIndicator();
|
||||
public HealthIndicator applicationHealthIndicator() {
|
||||
return new ApplicationHealthIndicator();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
@ -23,7 +23,7 @@ package org.springframework.boot.actuate.health;
|
||||
* @author Christian Dupuis
|
||||
* @see Status#UP
|
||||
*/
|
||||
public class VanillaHealthIndicator extends AbstractHealthIndicator {
|
||||
public class ApplicationHealthIndicator extends AbstractHealthIndicator {
|
||||
|
||||
@Override
|
||||
protected void doHealthCheck(Health.Builder builder) throws Exception {
|
@ -20,7 +20,7 @@ package org.springframework.boot.actuate.health;
|
||||
* Strategy interface used to provide an indication of application health.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @see VanillaHealthIndicator
|
||||
* @see ApplicationHealthIndicator
|
||||
*/
|
||||
public interface HealthIndicator {
|
||||
|
||||
|
@ -27,7 +27,7 @@ import org.springframework.boot.actuate.health.MongoHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.RabbitHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.RedisHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.SolrHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.VanillaHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.ApplicationHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
@ -70,7 +70,7 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||
Map<String, HealthIndicator> beans = this.context
|
||||
.getBeansOfType(HealthIndicator.class);
|
||||
assertEquals(1, beans.size());
|
||||
assertEquals(VanillaHealthIndicator.class, beans.values().iterator().next()
|
||||
assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next()
|
||||
.getClass());
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||
Map<String, HealthIndicator> beans = this.context
|
||||
.getBeansOfType(HealthIndicator.class);
|
||||
assertEquals(1, beans.size());
|
||||
assertEquals(VanillaHealthIndicator.class, beans.values().iterator().next()
|
||||
assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next()
|
||||
.getClass());
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||
Map<String, HealthIndicator> beans = this.context
|
||||
.getBeansOfType(HealthIndicator.class);
|
||||
assertEquals(1, beans.size());
|
||||
assertEquals(VanillaHealthIndicator.class, beans.values().iterator().next()
|
||||
assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next()
|
||||
.getClass());
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||
Map<String, HealthIndicator> beans = this.context
|
||||
.getBeansOfType(HealthIndicator.class);
|
||||
assertEquals(1, beans.size());
|
||||
assertEquals(VanillaHealthIndicator.class, beans.values().iterator().next()
|
||||
assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next()
|
||||
.getClass());
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||
Map<String, HealthIndicator> beans = this.context
|
||||
.getBeansOfType(HealthIndicator.class);
|
||||
assertEquals(1, beans.size());
|
||||
assertEquals(VanillaHealthIndicator.class, beans.values().iterator().next()
|
||||
assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next()
|
||||
.getClass());
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||
Map<String, HealthIndicator> beans = this.context
|
||||
.getBeansOfType(HealthIndicator.class);
|
||||
assertEquals(1, beans.size());
|
||||
assertEquals(VanillaHealthIndicator.class, beans.values().iterator().next()
|
||||
assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next()
|
||||
.getClass());
|
||||
}
|
||||
}
|
||||
|
@ -21,15 +21,15 @@ import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Tests for {@link VanillaHealthIndicator}.
|
||||
* Tests for {@link ApplicationHealthIndicator}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
public class VanillaHealthIndicatorTests {
|
||||
public class ApplicationHealthIndicatorTests {
|
||||
|
||||
@Test
|
||||
public void indicatesUp() throws Exception {
|
||||
VanillaHealthIndicator healthIndicator = new VanillaHealthIndicator();
|
||||
ApplicationHealthIndicator healthIndicator = new ApplicationHealthIndicator();
|
||||
assertEquals(Status.UP, healthIndicator.health().getStatus());
|
||||
}
|
||||
|
@ -75,7 +75,8 @@ public class SampleActuatorUiApplicationPortTests {
|
||||
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(
|
||||
"http://localhost:" + this.managementPort + "/health", String.class);
|
||||
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
||||
assertEquals("{\"status\":\"UP\"}", entity.getBody());
|
||||
assertEquals("{\"status\":\"UP\",\"application\":{\"status\":\"UP\"}}",
|
||||
entity.getBody());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user