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 ComponentScan boundaries so that applications control which self-tracked payload
types become active without exposing those payload types as regular Spring beans.
All detected @TrackSelf types and concrete implementations of annotated interfaces are wrapped as
FluxzeroPrototype and registered as Spring bean definitions, allowing Fluxzero to discover and register them
as self-tracking projections at runtime. Interface-level conditions are evaluated before their implementations are
discovered.
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 TypeMethodDescriptionexpandCandidateTypes(List<Class<?>> candidates, List<String> basePackages, org.springframework.context.annotation.ComponentScan componentScan, org.springframework.beans.factory.support.BeanDefinitionRegistry registry, org.springframework.core.io.ResourceLoader resourceLoader) findImplementations(List<Class<?>> targetTypes, List<String> basePackages, org.springframework.context.annotation.ComponentScan componentScan, org.springframework.beans.factory.support.BeanDefinitionRegistry registry, org.springframework.core.io.ResourceLoader resourceLoader) protected Stringprotected org.springframework.core.type.filter.TypeFiltervoidpostProcessBeanDefinitionRegistry(@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
-
getTargetTypeFilter
protected org.springframework.core.type.filter.TypeFilter getTargetTypeFilter() -
expandCandidateTypes
protected Stream<Class<?>> expandCandidateTypes(List<Class<?>> candidates, List<String> basePackages, org.springframework.context.annotation.ComponentScan componentScan, org.springframework.beans.factory.support.BeanDefinitionRegistry registry, org.springframework.core.io.ResourceLoader resourceLoader) -
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
-
findImplementations
protected Stream<Class<?>> findImplementations(List<Class<?>> targetTypes, List<String> basePackages, org.springframework.context.annotation.ComponentScan componentScan, org.springframework.beans.factory.support.BeanDefinitionRegistry registry, org.springframework.core.io.ResourceLoader resourceLoader)
-