Class RepositoryRegistrationAotProcessor
- All Implemented Interfaces:
BeanRegistrationAotProcessor, Aware, BeanFactoryAware, EnvironmentAware, EnvironmentCapable
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 registerRepositoryCompositionHints(AotRepositoryContext, GenerationContext) (specifically
configureTypeContribution(Class, AotContext) and contributeAotRepository(AotRepositoryContext),
stores can provide custom logic for contributing additional (e.g. 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, Mark Paluch
-
Field Summary
Fields inherited from interface BeanRegistrationAotProcessor
IGNORE_REGISTRATION_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureTypeContribution(Class<?> type, AotContext aotContext) Customization hook to configure theTypeContributorused to register the given type.protected voidconfigureTypeContributions(AotRepositoryContext repositoryContext, GenerationContext generationContext) Register type-specific hints and AOT artifacts for domain types, reachable types, projection interfaces derived from query method return types, and annotations from org.springframework.data packages.protected @Nullable RepositoryContributorcontributeAotRepository(AotRepositoryContext repositoryContext) This method allows for the creation to be overridden by subclasses.protected ConfigurableListableBeanFactory@Nullable BeanRegistrationAotContributionprotected voidregisterRepositoryCompositionHints(AotRepositoryContext repositoryContext, GenerationContext generationContext) Contribute repository-specific hints, e.g. for repository proxy, base implementation, fragments.voidsetBeanFactory(BeanFactory beanFactory) voidsetConfigMap(Map<String, RepositoryConfiguration<?>> configMap) Setter for the config map.voidsetEnvironment(Environment environment) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BeanRegistrationAotProcessor
isBeanExcludedFromAotProcessing
-
Constructor Details
-
RepositoryRegistrationAotProcessor
public RepositoryRegistrationAotProcessor()
-
-
Method Details
-
setBeanFactory
- Specified by:
setBeanFactoryin interfaceBeanFactoryAware- Throws:
BeansException
-
setEnvironment
- Specified by:
setEnvironmentin interfaceEnvironmentAware
-
getEnvironment
- Specified by:
getEnvironmentin interfaceEnvironmentCapable
-
setConfigMap
Setter for the config map. SeeRepositoryConfigurationDelegate#registerAotComponents.- Parameters:
configMap-
-
getConfigMap
-
getBeanFactory
-
processAheadOfTime
- Specified by:
processAheadOfTimein interfaceBeanRegistrationAotProcessor
-
registerRepositoryCompositionHints
protected void registerRepositoryCompositionHints(AotRepositoryContext repositoryContext, GenerationContext generationContext) Contribute repository-specific hints, e.g. for repository proxy, base implementation, fragments. Customization hook for subclasses that wish to customize repository hint contribution.- Parameters:
repositoryContext- the repository context.generationContext- the generation context.- Since:
- 4.0
-
configureTypeContributions
protected void configureTypeContributions(AotRepositoryContext repositoryContext, GenerationContext generationContext) Register type-specific hints and AOT artifacts for domain types, reachable types, projection interfaces derived from query method return types, and annotations from org.springframework.data packages.- Parameters:
repositoryContext- the repository context.generationContext- the generation context.- Since:
- 4.0
-
configureTypeContribution
Customization hook to configure theTypeContributorused to register the given type.- Parameters:
type- the class to configure the contribution for.aotContext- AOT context for type configuration.- Since:
- 4.0
-
contributeAotRepository
protected @Nullable RepositoryContributor contributeAotRepository(AotRepositoryContext repositoryContext) This method allows for the creation to be overridden by subclasses.- Parameters:
repositoryContext- the context for the repository being processed.- Returns:
- a
RepositoryContributorto contribute store-specific AOT artifacts or null to skip store-specific AOT contributions. - Since:
- 4.0
-