Class StatefulPostProcessor
java.lang.Object
io.fluxcapacitor.javaclient.configuration.spring.StatefulPostProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.config.BeanFactoryPostProcessor
,org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
public class StatefulPostProcessor
extends Object
implements org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
Spring
BeanDefinitionRegistryPostProcessor
that automatically detects beans annotated with Stateful
and registers them as FluxPrototype
definitions for use in Flux Capacitor.
This enables Flux to treat prototype-scoped, stateful beans as handler instances that are discovered and
managed at runtime by the handler registry (via the HandlerFactory
).
Usage
To use this mechanism, annotate a Spring bean with@Stateful
and ensure that Spring picks up this processor,
for example via FluxCapacitorSpringConfig
.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
postProcessBeanDefinitionRegistry
(@NonNull org.springframework.beans.factory.support.BeanDefinitionRegistry registry) No-op.void
postProcessBeanFactory
(@NonNull org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) Scans for beans annotated withStateful
, wraps each of them in aFluxPrototype
, and registers them programmatically as Spring bean definitions.
-
Constructor Details
-
StatefulPostProcessor
public StatefulPostProcessor()
-
-
Method Details
-
postProcessBeanFactory
public void postProcessBeanFactory(@NonNull @NonNull org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) throws org.springframework.beans.BeansException Scans for beans annotated withStateful
, wraps each of them in aFluxPrototype
, and registers them programmatically as Spring bean definitions.If the bean factory does not support dynamic registration (i.e., is not a
BeanDefinitionRegistry
), a warning is logged and the operation is skipped.- Specified by:
postProcessBeanFactory
in interfaceorg.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
- Specified by:
postProcessBeanFactory
in interfaceorg.springframework.beans.factory.config.BeanFactoryPostProcessor
- Parameters:
beanFactory
- the currentConfigurableListableBeanFactory
- Throws:
org.springframework.beans.BeansException
-
postProcessBeanDefinitionRegistry
public void postProcessBeanDefinitionRegistry(@NonNull @NonNull org.springframework.beans.factory.support.BeanDefinitionRegistry registry) throws org.springframework.beans.BeansException No-op. This implementation does not modify the registry at this phase.- Specified by:
postProcessBeanDefinitionRegistry
in interfaceorg.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
- Parameters:
registry
- theBeanDefinitionRegistry
- Throws:
org.springframework.beans.BeansException
-