Class DefaultLifecycleManager
java.lang.Object
dk.cloudcreate.essentials.components.foundation.lifecycle.DefaultLifecycleManager
- All Implemented Interfaces:
LifecycleManager,EventListener,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener<org.springframework.context.event.ApplicationContextEvent>
public final class DefaultLifecycleManager
extends Object
implements LifecycleManager, org.springframework.context.ApplicationListener<org.springframework.context.event.ApplicationContextEvent>, org.springframework.context.ApplicationContextAware
Default
LifecycleManager that integrate with Spring to ensure that ApplicationContext Beans that implement the Lifecycle
interface are started and stopped in response to ContextRefreshedEvent and ContextClosedEvent-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultLifecycleManager(boolean isStartLifecycles) DefaultLifecycleManager(Consumer<org.springframework.context.ApplicationContext> contextRefreshedEventConsumer, boolean isStartLifecycles) -
Method Summary
Modifier and TypeMethodDescriptionvoidonApplicationEvent(org.springframework.context.event.ApplicationContextEvent event) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Field Details
-
log
public static final org.slf4j.Logger log
-
-
Constructor Details
-
DefaultLifecycleManager
public DefaultLifecycleManager(Consumer<org.springframework.context.ApplicationContext> contextRefreshedEventConsumer, boolean isStartLifecycles) - Parameters:
contextRefreshedEventConsumer- callback that will be called after allLifecycleBeansLifecycle.start()has been calledisStartLifecycles- determines if lifecycle beans should be started automatically
-
DefaultLifecycleManager
public DefaultLifecycleManager(boolean isStartLifecycles) - Parameters:
isStartLifecycles- determines if lifecycle beans should be started automatically
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.event.ApplicationContextEvent event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.context.event.ApplicationContextEvent>
-