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
Constructors -
Method Summary
Modifier and TypeMethodDescription<S extends AvailabilityState>
AvailabilityChangeEvent<S>getLastChangeEvent(Class<S> stateType) Return the lastAvailabilityChangeEventreceived for a given state type.<S extends AvailabilityState>
SReturnAvailabilityStateinformation for the application.<S extends AvailabilityState>
SReturnAvailabilityStateinformation for the application.voidonApplicationEvent(AvailabilityChangeEvent<?> event) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.boot.availability.ApplicationAvailability
getLivenessState, getReadinessStateMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
ApplicationAvailabilityBean
public ApplicationAvailabilityBean()
-
-
Method Details
-
getState
Description copied from interface:ApplicationAvailabilityReturnAvailabilityStateinformation for the application.- Specified by:
getStatein 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:ApplicationAvailabilityReturnAvailabilityStateinformation for the application.- Specified by:
getStatein interfaceApplicationAvailability- Type Parameters:
S- the state type- Parameters:
stateType- the state type- Returns:
- the readiness state or
nullif 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:ApplicationAvailabilityReturn the lastAvailabilityChangeEventreceived for a given state type.- Specified by:
getLastChangeEventin interfaceApplicationAvailability- Type Parameters:
S- the state type- Parameters:
stateType- the state type- Returns:
- the readiness state or
nullif no event of the given type has been published yet
-
onApplicationEvent
- Specified by:
onApplicationEventin interfaceApplicationListener<AvailabilityChangeEvent<?>>
-