• Brian Clozel's avatar
    Add Kubernetes Liveness and Readiness Probes support · fd0b2f66
    Brian Clozel authored
    Prior to this commit and as of Spring Boot 2.2.0, we would advise
    developers to use the Actuator health groups to define custom "liveness"
    and "readiness" groups and configure them with subsets of existing
    health indicators.
    
    This commit addresses several limitations with that approach.
    
    First, `LivenessState` and `ReadinessState` are promoted to first class
    concepts in Spring Boot applications. These states should not only based
    on periodic health checks. Applications should be able to track changes
    (and adapt their behavior) or update states (when an error happens).
    
    The `ApplicationStateProvider` can be injected and used by applications
    components to get the current application state. Components can also
    track specific `ApplicationEvent` to be notified of changes, like
    `ReadinessStateChangedEvent` and `LivenessStateChangedEvent`.
    Components can also publish such events with an
    `ApplicationEventPublisher`. Spring Boot will track startup event and
    application context state to update the liveness and readiness state of
    the application. This infrastructure is available in the
    main spring-boot module.
    
    If Spring Boot Actuator is on the classpath, additional
    `HealthIndicator` will be contributed to the application:
    `"LivenessProveHealthIndicator"` and `"ReadinessProbeHealthIndicator"`.
    Also, "liveness" and "readiness" Health groups will be defined if
    they're not configured already.
    
    Closes gh-19593
    fd0b2f66
spring.factories 10.4 KB