|
|
@ -19,9 +19,9 @@ package org.springframework.bootstrap.actuate.autoconfigure;
|
|
|
|
import javax.servlet.Servlet;
|
|
|
|
import javax.servlet.Servlet;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.bootstrap.actuate.health.HealthIndicator;
|
|
|
|
import org.springframework.bootstrap.actuate.endpoint.health.HealthEndpoint;
|
|
|
|
import org.springframework.bootstrap.actuate.health.HealthzEndpoint;
|
|
|
|
import org.springframework.bootstrap.actuate.endpoint.health.HealthIndicator;
|
|
|
|
import org.springframework.bootstrap.actuate.health.VanillaHealthIndicator;
|
|
|
|
import org.springframework.bootstrap.actuate.endpoint.health.VanillaHealthIndicator;
|
|
|
|
import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
|
|
|
|
import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
|
|
|
|
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
|
|
|
|
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
|
|
|
|
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
|
|
|
|
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
|
|
|
@ -30,21 +30,21 @@ import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.web.servlet.DispatcherServlet;
|
|
|
|
import org.springframework.web.servlet.DispatcherServlet;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* {@link EnableAutoConfiguration Auto-configuration} for /healthz endpoint.
|
|
|
|
* {@link EnableAutoConfiguration Auto-configuration} for /health endpoint.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Dave Syer
|
|
|
|
* @author Dave Syer
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
|
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class })
|
|
|
|
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class })
|
|
|
|
@ConditionalOnMissingBean({ HealthzEndpoint.class })
|
|
|
|
@ConditionalOnMissingBean({ HealthEndpoint.class })
|
|
|
|
public class HealthzConfiguration {
|
|
|
|
public class HealthConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired(required = false)
|
|
|
|
@Autowired(required = false)
|
|
|
|
private HealthIndicator<? extends Object> healthIndicator = new VanillaHealthIndicator();
|
|
|
|
private HealthIndicator<? extends Object> healthIndicator = new VanillaHealthIndicator();
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public HealthzEndpoint<? extends Object> healthzEndpoint() {
|
|
|
|
public HealthEndpoint<? extends Object> healthzEndpoint() {
|
|
|
|
return new HealthzEndpoint<Object>(healthIndicator);
|
|
|
|
return new HealthEndpoint<Object>(this.healthIndicator);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|