Class ApplicationAvailabilityBean
java.lang.Object
org.springframework.boot.availability.ApplicationAvailabilityBean
- All Implemented Interfaces:
EventListener
,ApplicationAvailability
,ApplicationListener<AvailabilityChangeEvent<?>>
public class ApplicationAvailabilityBean
extends Object
implements ApplicationAvailability, ApplicationListener<AvailabilityChangeEvent<?>>
Bean that provides an
ApplicationAvailability
implementation by listening for
change events
.- Since:
- 2.3.0
- Author:
- Brian Clozel, Phillip Webb
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<S extends AvailabilityState>
AvailabilityChangeEvent<S>getLastChangeEvent
(Class<S> stateType) Return the lastAvailabilityChangeEvent
received for a given state type.<S extends AvailabilityState>
SReturnAvailabilityState
information for the application.<S extends AvailabilityState>
SReturnAvailabilityState
information for the application.void
onApplicationEvent
(AvailabilityChangeEvent<?> event) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.boot.availability.ApplicationAvailability
getLivenessState, getReadinessState
-
Constructor Details
-
ApplicationAvailabilityBean
public ApplicationAvailabilityBean()
-
-
Method Details
-
getState
Description copied from interface:ApplicationAvailability
ReturnAvailabilityState
information for the application.- Specified by:
getState
in interfaceApplicationAvailability
- Type Parameters:
S
- the state type- Parameters:
stateType
- the state typedefaultState
- the default state to return if no event of the given type has been published yet (must not benull
).- Returns:
- the readiness state
- See Also:
-
getState
Description copied from interface:ApplicationAvailability
ReturnAvailabilityState
information for the application.- Specified by:
getState
in interfaceApplicationAvailability
- 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
public <S extends AvailabilityState> AvailabilityChangeEvent<S> getLastChangeEvent(Class<S> stateType) Description copied from interface:ApplicationAvailability
Return the lastAvailabilityChangeEvent
received for a given state type.- Specified by:
getLastChangeEvent
in interfaceApplicationAvailability
- 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
-
onApplicationEvent
- Specified by:
onApplicationEvent
in interfaceApplicationListener<AvailabilityChangeEvent<?>>
-