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 the
All you need to do is to add a @Bean of type
EventBus, CommandBus, CommandHandler and EventHandler instances as @Bean or @Component
and automatically have the CommandHandler beans registered as with the single CommandBus bean and the EventHandler beans registered as subscribers with one or more EventBus beans.
All you need to do is to add a @Bean of type
ReactiveHandlersBeanPostProcessor which:
Registers CommandHandler or EventHandler's in the application context with the single
EventBus's and CommandBus defined in the application context.EventHandler's are registered as synchronous event handler's (EventBus.addSyncSubscriber(EventHandler))
unless it's annotated with the AsyncEventHandler annotation, in which case it's registered as an asynchronous event handler
(EventBus.addAsyncSubscriber(EventHandler)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionpostProcessAfterInitialization(Object bean, String beanName) voidpostProcessBeforeDestruction(Object bean, String beanName) booleanrequiresDestruction(Object bean) 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.beans.factory.config.BeanPostProcessor
postProcessBeforeInitialization
-
Constructor Details
-
ReactiveHandlersBeanPostProcessor
public ReactiveHandlersBeanPostProcessor()
-
-
Method Details
-
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
- 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
-