Class RepositoryRegistrationAotContribution
java.lang.Object
org.springframework.data.repository.config.RepositoryRegistrationAotContribution
- All Implemented Interfaces:
org.springframework.beans.factory.aot.BeanRegistrationAotContribution
public class RepositoryRegistrationAotContribution
extends Object
implements org.springframework.beans.factory.aot.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(org.springframework.aot.generate.GenerationContext generationContext, org.springframework.beans.factory.aot.BeanRegistrationCode beanRegistrationCode) protected org.springframework.data.repository.config.DefaultAotRepositoryContextbuildAotRepositoryContext(org.springframework.beans.factory.support.RegisteredBean bean, RepositoryConfiguration<?> repositoryMetadata) protected voidenhanceRepositoryBeanDefinition(org.springframework.beans.factory.support.RegisteredBean repositoryBean, RepositoryConfiguration<?> repositoryMetadata, AotRepositoryContext repositoryContext) Helps the AOT processing render theFactoryBeantype correctly that is used to tell the outcome of theFactoryBean.forBean(org.springframework.beans.factory.support.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 org.springframework.beans.factory.config.ConfigurableListableBeanFactoryprotected Optional<BiConsumer<AotRepositoryContext,org.springframework.aot.generate.GenerationContext>> protected AotRepositoryContextprotected RepositoryRegistrationAotProcessorwithModuleContribution(BiConsumer<AotRepositoryContext, org.springframework.aot.generate.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
protected org.springframework.beans.factory.config.ConfigurableListableBeanFactory getBeanFactory() -
getModuleContribution
protected Optional<BiConsumer<AotRepositoryContext,org.springframework.aot.generate.GenerationContext>> getModuleContribution() -
getRepositoryContext
-
getRepositoryRegistrationAotProcessor
-
getRepositoryInformation
-
forBean
public RepositoryRegistrationAotContribution forBean(org.springframework.beans.factory.support.RegisteredBean repositoryBean) 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:
-
RegisteredBean
-
buildAotRepositoryContext
protected org.springframework.data.repository.config.DefaultAotRepositoryContext buildAotRepositoryContext(org.springframework.beans.factory.support.RegisteredBean bean, RepositoryConfiguration<?> repositoryMetadata) -
enhanceRepositoryBeanDefinition
protected void enhanceRepositoryBeanDefinition(org.springframework.beans.factory.support.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, org.springframework.aot.generate.GenerationContext> moduleContribution) Callbackfor data module specific contributions.- Parameters:
moduleContribution-BiConsumerused by data modules to submit contributions; can be null.- Returns:
- this.
-
applyTo
public void applyTo(org.springframework.aot.generate.GenerationContext generationContext, org.springframework.beans.factory.aot.BeanRegistrationCode beanRegistrationCode) - Specified by:
applyToin interfaceorg.springframework.beans.factory.aot.BeanRegistrationAotContribution
-
typeFilter
-