Class SpringEventSourcedEntityLookup
java.lang.Object
org.axonframework.extension.spring.config.SpringEventSourcedEntityLookup
- All Implemented Interfaces:
org.springframework.beans.factory.config.BeanFactoryPostProcessor,org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
@Internal
public class SpringEventSourcedEntityLookup
extends Object
implements org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
A
BeanDefinitionRegistryPostProcessor implementation that scans for Entity types and registers a
configurer for each Entity found.
Polymorphic entity hierarchies whose abstract parent lists its subtypes through EventSourced.concreteTypes()
are never registered as a BeanDefinition by Spring's own component scan (abstract classes are not candidate
components), so they cannot be found through ListableBeanFactory.getBeanNamesForAnnotation(Class). To support
that documented pattern, this class additionally runs its own classpath scan (see #findAbstractEntityRoots())
across the given basePackages, independent of Spring's bean registry, to locate those abstract roots
directly.
- Since:
- 4.6.0
- Author:
- Allard Buijze, Simon Zambrovski
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aSpringEventSourcedEntityLookupdiscovering entities through Spring's bean registry.SpringEventSourcedEntityLookup(List<String> basePackages) Constructs aSpringEventSourcedEntityLookupthat, in addition to the regular bean-registry-based discovery, scans the givenbasePackagesfor abstract polymorphic entity roots (see#findAbstractEntityRoots()). -
Method Summary
Modifier and TypeMethodDescriptionvoidpostProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) voidpostProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
-
Constructor Details
-
SpringEventSourcedEntityLookup
public SpringEventSourcedEntityLookup()Constructs aSpringEventSourcedEntityLookupdiscovering entities through Spring's bean registry. -
SpringEventSourcedEntityLookup
Constructs aSpringEventSourcedEntityLookupthat, in addition to the regular bean-registry-based discovery, scans the givenbasePackagesfor abstract polymorphic entity roots (see#findAbstractEntityRoots()).- Parameters:
basePackages- the packages to scan for abstract classes annotated withEventSourced
-
-
Method Details
-
postProcessBeanFactory
public void postProcessBeanFactory(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(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
-