Class TrackSelfPostProcessor
java.lang.Object
io.fluxzero.sdk.configuration.spring.TrackSelfPostProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, org.springframework.context.EnvironmentAware
Spring
BeanDefinitionRegistryPostProcessor that detects classes
annotated with TrackSelf
and registers them as FluxzeroPrototype beans for use by Fluxzero.
The scan follows Spring's
boundaries so that applications control which self-tracked payload
types become active without exposing those payload types as regular Spring beans.
invalid reference
ComponentScan
All detected @TrackSelf types are wrapped as FluxzeroPrototype and registered as Spring bean
definitions, allowing Fluxzero to discover and register them as self-tracking projections at runtime.
Usage
To enable self-tracking on a class use e.g.:@TrackSelf
public interface UserUpdate {
UserId getUserId();
@HandleCommand
default void handle() {
Fluxzero.loadAggregate(getUserId()).assertAndApply(this);
}
}
Make sure Spring picks up this processor, for example by including
FluxzeroSpringConfig in your configuration:
@SpringBootApplication
@Import(FluxzeroSpringConfig.class)
public class MyApp { ... }
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringvoidpostProcessBeanDefinitionRegistry(@NonNull org.springframework.beans.factory.support.BeanDefinitionRegistry registry) voidpostProcessBeanFactory(@NonNull org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) voidsetEnvironment(org.springframework.core.env.Environment environment)
-
Constructor Details
-
TrackSelfPostProcessor
public TrackSelfPostProcessor()
-
-
Method Details
-
getTargetAnnotation
-
getBeanNameSuffix
-
postProcessBeanFactory
public void postProcessBeanFactory(@NonNull @NonNull org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
postProcessBeanFactoryin interfaceorg.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor- Specified by:
postProcessBeanFactoryin interfaceorg.springframework.beans.factory.config.BeanFactoryPostProcessor- Throws:
org.springframework.beans.BeansException
-
postProcessBeanDefinitionRegistry
public void postProcessBeanDefinitionRegistry(@NonNull @NonNull org.springframework.beans.factory.support.BeanDefinitionRegistry registry) throws org.springframework.beans.BeansException - Specified by:
postProcessBeanDefinitionRegistryin interfaceorg.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor- Throws:
org.springframework.beans.BeansException
-
setEnvironment
public void setEnvironment(org.springframework.core.env.Environment environment) - Specified by:
setEnvironmentin interfaceorg.springframework.context.EnvironmentAware
-