Class ReactiveHandlersBeanPostProcessor
- java.lang.Object
-
- dk.cloudcreate.essentials.reactive.spring.ReactiveHandlersBeanPostProcessor
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.config.BeanPostProcessor,org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor,org.springframework.context.ApplicationContextAware
public class ReactiveHandlersBeanPostProcessor extends Object implements org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor, org.springframework.context.ApplicationContextAware
When using Spring or Spring Boot it will be easier to register theEventBus,CommandBus,CommandHandlerandEventHandlerinstances as @Bean or @Component and automatically have theCommandHandlerbeans registered as with the singleCommandBusbean and theEventHandlerbeans registered as subscribers with one or moreEventBusbeans.
All you need to do is to add a @Bean of typeReactiveHandlersBeanPostProcessorwhich: RegistersCommandHandlerorEventHandler's in the application context with the singleEventBus's andCommandBusdefined in the application context.
EventHandler's are registered as synchronous event handler's (EventBus.addSyncSubscriber(EventHandler)) unless it's annotated with theAsyncEventHandlerannotation, in which case it's registered as an asynchronous event handler (EventBus.addAsyncSubscriber(EventHandler)
-
-
Constructor Summary
Constructors Constructor Description ReactiveHandlersBeanPostProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectpostProcessAfterInitialization(Object bean, String beanName)voidpostProcessBeforeDestruction(Object bean, String beanName)booleanrequiresDestruction(Object bean)voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
-
-
Method Detail
-
postProcessAfterInitialization
public Object postProcessAfterInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException
- Specified by:
postProcessAfterInitializationin interfaceorg.springframework.beans.factory.config.BeanPostProcessor- Throws:
org.springframework.beans.BeansException
-
postProcessBeforeDestruction
public void postProcessBeforeDestruction(Object bean, String beanName) throws org.springframework.beans.BeansException
- Specified by:
postProcessBeforeDestructionin interfaceorg.springframework.beans.factory.config.DestructionAwareBeanPostProcessor- Throws:
org.springframework.beans.BeansException
-
requiresDestruction
public boolean requiresDestruction(Object bean)
- Specified by:
requiresDestructionin interfaceorg.springframework.beans.factory.config.DestructionAwareBeanPostProcessor
-
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
-
-