Interface ApplicationAvailability

All Known Implementing Classes:
ApplicationAvailabilityBean

public interface ApplicationAvailability
Provides availability state information for the application.

Components can inject this class to get the current state information. To update the state of the application an AvailabilityChangeEvent should be published to the application context with directly or through AvailabilityChangeEvent.publish(org.springframework.context.ApplicationContext, S).

Since:
2.3.0
  • Method Details

    • getLivenessState

      default LivenessState getLivenessState()
      Return the LivenessState of the application.
      Returns:
      the liveness state
    • getReadinessState

      default ReadinessState getReadinessState()
      Return the ReadinessState of the application.
      Returns:
      the readiness state
    • getState

      <S extends AvailabilityState> S getState(Class<S> stateType, S defaultState)
      Return AvailabilityState information for the application.
      Type Parameters:
      S - the state type
      Parameters:
      stateType - the state type
      defaultState - the default state to return if no event of the given type has been published yet (must not be null).
      Returns:
      the readiness state
      See Also:
    • getState

      <S extends AvailabilityState> S getState(Class<S> stateType)
      Return AvailabilityState information for the application.
      Type Parameters:
      S - the state type
      Parameters:
      stateType - the state type
      Returns:
      the readiness state or null if no event of the given type has been published yet
      See Also:
    • getLastChangeEvent

      <S extends AvailabilityState> AvailabilityChangeEvent<S> getLastChangeEvent(Class<S> stateType)
      Return the last AvailabilityChangeEvent received for a given state type.
      Type Parameters:
      S - the state type
      Parameters:
      stateType - the state type
      Returns:
      the readiness state or null if no event of the given type has been published yet