Class Health
java.lang.Object
org.springframework.boot.actuate.health.HealthComponent
org.springframework.boot.actuate.health.Health
- All Implemented Interfaces:
OperationResponseBody
Carries information about the health of a component or subsystem. Extends
HealthComponent
so that additional contextual details about the system can be
returned along with the Status
.
Health
instances can be created by using Health.Builder
's fluent API. Typical
usage in a HealthIndicator
would be:
try { // do some test to determine state of component return Health.up().withDetail("version", "1.1.2").build(); } catch (Exception ex) { return Health.down(ex).build(); }
- Since:
- 1.1.0
- Author:
- Christian Dupuis, Phillip Webb, Michael Pratt, Moritz Halbritter
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Health.Builder
down()
Create a newHealth.Builder
instance with aStatus.DOWN
status.static Health.Builder
Create a newHealth.Builder
instance with anStatus.DOWN
status and the specified exception details.boolean
Return the details of the health.Return the status of the health.int
hashCode()
static Health.Builder
Create a newHealth.Builder
instance with anStatus.OUT_OF_SERVICE
status.static Health.Builder
Create a newHealth.Builder
instance with a specific status code.static Health.Builder
Create a newHealth.Builder
instance with a specificStatus
.toString()
static Health.Builder
unknown()
Create a newHealth.Builder
instance with anStatus.UNKNOWN
status.static Health.Builder
up()
Create a newHealth.Builder
instance with anStatus.UP
status.
-
Method Details
-
getStatus
Return the status of the health.- Specified by:
getStatus
in classHealthComponent
- Returns:
- the status (never
null
)
-
getDetails
Return the details of the health.- Returns:
- the details (or an empty map)
-
equals
-
hashCode
public int hashCode() -
toString
-
unknown
Create a newHealth.Builder
instance with anStatus.UNKNOWN
status.- Returns:
- a new
Health.Builder
instance
-
up
Create a newHealth.Builder
instance with anStatus.UP
status.- Returns:
- a new
Health.Builder
instance
-
down
Create a newHealth.Builder
instance with anStatus.DOWN
status and the specified exception details.- Parameters:
ex
- the exception- Returns:
- a new
Health.Builder
instance
-
down
Create a newHealth.Builder
instance with aStatus.DOWN
status.- Returns:
- a new
Health.Builder
instance
-
outOfService
Create a newHealth.Builder
instance with anStatus.OUT_OF_SERVICE
status.- Returns:
- a new
Health.Builder
instance
-
status
Create a newHealth.Builder
instance with a specific status code.- Parameters:
statusCode
- the status code- Returns:
- a new
Health.Builder
instance
-
status
Create a newHealth.Builder
instance with a specificStatus
.- Parameters:
status
- the status- Returns:
- a new
Health.Builder
instance
-