Package org.springframework.data.aot
Class RepositoryRegistrationAotContribution
java.lang.Object
org.springframework.data.aot.RepositoryRegistrationAotContribution
- All Implemented Interfaces:
BeanRegistrationAotContribution
public class RepositoryRegistrationAotContribution
extends Object
implements BeanRegistrationAotContribution
BeanRegistrationAotContribution used to contribute repository registrations.- Since:
- 3.0
- Author:
- John Blum
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRepositoryRegistrationAotContribution(RepositoryRegistrationAotProcessor repositoryRegistrationAotProcessor) Constructs a new instance of theRepositoryRegistrationAotContributioninitialized with the given, requiredRepositoryRegistrationAotProcessorfrom which this contribution was created. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTo(GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode) protected org.springframework.data.aot.DefaultAotRepositoryContextbuildAotRepositoryContext(RegisteredBean bean, RepositoryConfiguration<?> repositoryMetadata) protected voidenhanceRepositoryBeanDefinition(RegisteredBean repositoryBean, RepositoryConfiguration<?> repositoryMetadata, AotRepositoryContext repositoryContext) Helps the AOT processing render theFactoryBeantype correctly that is used to tell the outcome of theFactoryBean.forBean(RegisteredBean repositoryBean) Builds aRepositoryRegistrationAotContributionfor given, requiredRegisteredBeanrepresenting theRepositoryregistered in the bean registry.fromProcessor(RepositoryRegistrationAotProcessor repositoryRegistrationAotProcessor) Factory method used to construct a new instance ofRepositoryRegistrationAotContributioninitialized with the given, requiredRepositoryRegistrationAotProcessorfrom which this contribution was created.protected ConfigurableListableBeanFactoryprotected Optional<BiConsumer<AotRepositoryContext,GenerationContext>> protected AotRepositoryContextprotected RepositoryRegistrationAotProcessorwithModuleContribution(BiConsumer<AotRepositoryContext, GenerationContext> moduleContribution) Callbackfor data module specific contributions.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.aot.BeanRegistrationAotContribution
customizeBeanRegistrationCodeFragments
-
Constructor Details
-
RepositoryRegistrationAotContribution
protected RepositoryRegistrationAotContribution(RepositoryRegistrationAotProcessor repositoryRegistrationAotProcessor) Constructs a new instance of theRepositoryRegistrationAotContributioninitialized with the given, requiredRepositoryRegistrationAotProcessorfrom which this contribution was created.- Parameters:
repositoryRegistrationAotProcessor- reference back to theRepositoryRegistrationAotProcessorfrom which this contribution was created.- Throws:
IllegalArgumentException- if theRepositoryRegistrationAotProcessoris null.- See Also:
-
-
Method Details
-
fromProcessor
public static RepositoryRegistrationAotContribution fromProcessor(RepositoryRegistrationAotProcessor repositoryRegistrationAotProcessor) Factory method used to construct a new instance ofRepositoryRegistrationAotContributioninitialized with the given, requiredRepositoryRegistrationAotProcessorfrom which this contribution was created.- Parameters:
repositoryRegistrationAotProcessor- reference back to theRepositoryRegistrationAotProcessorfrom which this contribution was created.- Returns:
- a new instance of
RepositoryRegistrationAotContribution. - Throws:
IllegalArgumentException- if theRepositoryRegistrationAotProcessoris null.- See Also:
-
getBeanFactory
-
getModuleContribution
-
getRepositoryContext
-
getRepositoryRegistrationAotProcessor
-
getRepositoryInformation
-
forBean
Builds aRepositoryRegistrationAotContributionfor given, requiredRegisteredBeanrepresenting theRepositoryregistered in the bean registry.- Parameters:
repositoryBean-RegisteredBeanfor theRepository; must not be null.- Returns:
- a
RepositoryRegistrationAotContributionto contribute AOT metadata and code for theRepositoryRegisteredBean. - Throws:
IllegalArgumentException- if theRegisteredBeanis null.- See Also:
-
buildAotRepositoryContext
protected org.springframework.data.aot.DefaultAotRepositoryContext buildAotRepositoryContext(RegisteredBean bean, RepositoryConfiguration<?> repositoryMetadata) -
enhanceRepositoryBeanDefinition
protected void enhanceRepositoryBeanDefinition(RegisteredBean repositoryBean, RepositoryConfiguration<?> repositoryMetadata, AotRepositoryContext repositoryContext) Helps the AOT processing render theFactoryBeantype correctly that is used to tell the outcome of theFactoryBean. We just need to set the targetRepositorytypeof theRepositoryFactoryBeanSupportwhile keeping the actual ID and DomainType set toObject. If the generic type signature does not match, then we do not try to resolve and remap the types, but rather set the factoryBeanObjectType attribute on theRootBeanDefinition. -
withModuleContribution
public RepositoryRegistrationAotContribution withModuleContribution(@Nullable BiConsumer<AotRepositoryContext, GenerationContext> moduleContribution) Callbackfor data module specific contributions.- Parameters:
moduleContribution-BiConsumerused by data modules to submit contributions; can be null.- Returns:
- this.
-
applyTo
- Specified by:
applyToin interfaceBeanRegistrationAotContribution
-
typeFilter
-