|
|
@ -151,10 +151,10 @@ To provide custom health information you can register a Spring bean that impleme
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
|
|
@Component
|
|
|
|
@Component
|
|
|
|
public class MyHealth implements HealthIndicator<String> {
|
|
|
|
public class MyHealth implements HealthIndicator {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String health() {
|
|
|
|
public Health health() {
|
|
|
|
// perform some specific health check
|
|
|
|
// perform some specific health check
|
|
|
|
return ...
|
|
|
|
return ...
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -170,6 +170,16 @@ Redis, MongoDB and RabbitMQ.
|
|
|
|
Spring Boot adds the `HealthIndicator` instances automatically if beans of type `DataSource`,
|
|
|
|
Spring Boot adds the `HealthIndicator` instances automatically if beans of type `DataSource`,
|
|
|
|
`MongoTemplate`, `RedisConnectionFactory`, `RabbitTemplate` are present in the `ApplicationContext`.
|
|
|
|
`MongoTemplate`, `RedisConnectionFactory`, `RabbitTemplate` are present in the `ApplicationContext`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Besides implementing custom `HealthIndicator`s and using out-of-box {sc-spring-boot-actuator}/health/Status.{sc-ext}[`Status`]
|
|
|
|
|
|
|
|
types, it is also possible to introduce custom `Status` types for different or more complex system
|
|
|
|
|
|
|
|
states. In that case a custom implementation of the {sc-spring-boot-actuator}/health/HealthAggregator.{sc-ext}[`HealthAggregator`]
|
|
|
|
|
|
|
|
interface needs to be provided or the default implementation has to be configured using the
|
|
|
|
|
|
|
|
`health.status.order` configuration property.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assuming a new `Status` with code `FATAL` is being used in one of your `HealthIndicator`
|
|
|
|
|
|
|
|
implementations. To configure the severity or order add the following to your application properties:
|
|
|
|
|
|
|
|
`healt.status.order: FATAL, DOWN, UNKOWN, UP`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[production-ready-application-info]]
|
|
|
|
[[production-ready-application-info]]
|
|
|
|