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 Details

    • SpringEventSourcedEntityLookup

      public SpringEventSourcedEntityLookup()
      Constructs a SpringEventSourcedEntityLookup discovering entities through Spring's bean registry.
    • SpringEventSourcedEntityLookup

      public SpringEventSourcedEntityLookup(List<String> basePackages)
      Constructs a SpringEventSourcedEntityLookup that, in addition to the regular bean-registry-based discovery, scans the given basePackages for abstract polymorphic entity roots (see #findAbstractEntityRoots()).
      Parameters:
      basePackages - the packages to scan for abstract classes annotated with EventSourced
  • Method Details

    • postProcessBeanFactory

      public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) throws org.springframework.beans.BeansException
      Specified by:
      postProcessBeanFactory in interface org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
      Specified by:
      postProcessBeanFactory in interface org.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:
      postProcessBeanDefinitionRegistry in interface org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
      Throws:
      org.springframework.beans.BeansException