Class RepositoryRegistrationAotProcessor

java.lang.Object
org.springframework.data.repository.config.RepositoryRegistrationAotProcessor
All Implemented Interfaces:
org.springframework.beans.factory.aot.BeanRegistrationAotProcessor, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware

public class RepositoryRegistrationAotProcessor extends Object implements org.springframework.beans.factory.aot.BeanRegistrationAotProcessor, org.springframework.beans.factory.BeanFactoryAware
BeanRegistrationAotProcessor responsible processing and providing AOT configuration for repositories.

Processes repository factory beans to provide generic type information to the AOT tooling to allow deriving target type from the bean definition. If generic types do not match due to customization of the factory bean by the user, at least the target repository type is provided via the FactoryBean.OBJECT_TYPE_ATTRIBUTE.

With contribute(AotRepositoryContext, GenerationContext), stores can provide custom logic for contributing additional (eg. reflection) configuration. By default, reflection configuration will be added for types reachable from the repository declaration and query methods as well as all used annotations from the org.springframework.data namespace.

The processor is typically configured via RepositoryConfigurationExtension.getRepositoryAotProcessor() and gets added by the RepositoryConfigurationDelegate.
Since:
3.0
Author:
Christoph Strobl, John Blum
  • Constructor Details

    • RepositoryRegistrationAotProcessor

      public RepositoryRegistrationAotProcessor()
  • Method Details

    • processAheadOfTime

      @Nullable public org.springframework.beans.factory.aot.BeanRegistrationAotContribution processAheadOfTime(org.springframework.beans.factory.support.RegisteredBean bean)
      Specified by:
      processAheadOfTime in interface org.springframework.beans.factory.aot.BeanRegistrationAotProcessor
    • contribute

      protected void contribute(AotRepositoryContext repositoryContext, org.springframework.aot.generate.GenerationContext generationContext)
    • newRepositoryRegistrationAotContribution

      protected RepositoryRegistrationAotContribution newRepositoryRegistrationAotContribution(org.springframework.beans.factory.support.RegisteredBean repositoryBean)
    • setBeanFactory

      public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      Throws:
      org.springframework.beans.BeansException
    • getBeanFactory

      protected org.springframework.beans.factory.config.ConfigurableListableBeanFactory getBeanFactory()
    • setConfigMap

      public void setConfigMap(@Nullable Map<String,RepositoryConfiguration<?>> configMap)
    • getConfigMap

      public Map<String,RepositoryConfiguration<?>> getConfigMap()
    • getRepositoryMetadata

      @Nullable protected RepositoryConfiguration<?> getRepositoryMetadata(org.springframework.beans.factory.support.RegisteredBean bean)
    • getLogger

      protected org.apache.commons.logging.Log getLogger()
    • logDebug

      protected void logDebug(String message, Object... arguments)
    • logTrace

      protected void logTrace(String message, Object... arguments)
    • contributeType

      protected void contributeType(Class<?> type, org.springframework.aot.generate.GenerationContext generationContext)