Class HealthEndpoint
- java.lang.Object
- org.springframework.boot.actuate.endpoint.AbstractEndpoint<Health>
- org.springframework.boot.actuate.endpoint.HealthEndpoint
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,Endpoint<Health>,org.springframework.context.EnvironmentAware
@ConfigurationProperties(prefix="endpoints.health") public class HealthEndpoint extends AbstractEndpoint<Health>
Endpointto expose application health.
Constructor Summary
Constructors Constructor Description HealthEndpoint(HealthAggregator healthAggregator, Map<String,HealthIndicator> healthIndicators)Create a newHealthEndpointinstance.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetTimeToLive()Time to live for cached result.Healthinvoke()Invoke allHealthIndicatordelegates and collect their health information.voidsetTimeToLive(long timeToLive)Set the time to live for cached results.Methods inherited from class org.springframework.boot.actuate.endpoint.AbstractEndpoint
getEnvironment, getId, isEnabled, isSensitive, setEnabled, setEnvironment, setId, setSensitive
Constructor Detail
HealthEndpoint
public HealthEndpoint(HealthAggregator healthAggregator, Map<String,HealthIndicator> healthIndicators)
Create a newHealthEndpointinstance.- Parameters:
healthAggregator- the health aggregatorhealthIndicators- the health indicators
Method Detail
getTimeToLive
public long getTimeToLive()
Time to live for cached result. This is particularly useful to cache the result of this endpoint to prevent a DOS attack if it is accessed anonymously.- Returns:
- time to live in milliseconds (default 1000)
setTimeToLive
public void setTimeToLive(long timeToLive)
Set the time to live for cached results.- Parameters:
timeToLive- the time to live in milliseconds
invoke
public Health invoke()
Invoke allHealthIndicatordelegates and collect their health information.- Returns:
- the results of the invocation