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 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 with Stateful, wraps each of them in a FluxPrototype, 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 interface org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
      Specified by:
      postProcessBeanFactory in interface org.springframework.beans.factory.config.BeanFactoryPostProcessor
      Parameters:
      beanFactory - the current ConfigurableListableBeanFactory
      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 interface org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
      Parameters:
      registry - the BeanDefinitionRegistry
      Throws:
      org.springframework.beans.BeansException