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
ModifierConstructorDescriptionprotected
RepositoryRegistrationAotContribution
(RepositoryRegistrationAotProcessor repositoryRegistrationAotProcessor) Constructs a new instance of theRepositoryRegistrationAotContribution
initialized with the given, requiredRepositoryRegistrationAotProcessor
from which this contribution was created. -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyTo
(org.springframework.aot.generate.GenerationContext generationContext, org.springframework.beans.factory.aot.BeanRegistrationCode beanRegistrationCode) protected org.springframework.data.repository.config.DefaultAotRepositoryContext
buildAotRepositoryContext
(org.springframework.beans.factory.support.RegisteredBean bean, RepositoryConfiguration<?> repositoryMetadata) protected void
enhanceRepositoryBeanDefinition
(org.springframework.beans.factory.support.RegisteredBean repositoryBean, RepositoryConfiguration<?> repositoryMetadata, AotRepositoryContext repositoryContext) Helps the AOT processing render theFactoryBean
type correctly that is used to tell the outcome of theFactoryBean
.forBean
(org.springframework.beans.factory.support.RegisteredBean repositoryBean) Builds aRepositoryRegistrationAotContribution
for given, requiredRegisteredBean
representing theRepository
registered in the bean registry.fromProcessor
(RepositoryRegistrationAotProcessor repositoryRegistrationAotProcessor) Factory method used to construct a new instance ofRepositoryRegistrationAotContribution
initialized with the given, requiredRepositoryRegistrationAotProcessor
from which this contribution was created.protected org.springframework.beans.factory.config.ConfigurableListableBeanFactory
protected Optional<BiConsumer<AotRepositoryContext,
org.springframework.aot.generate.GenerationContext>> protected AotRepositoryContext
protected RepositoryRegistrationAotProcessor
withModuleContribution
(BiConsumer<AotRepositoryContext, org.springframework.aot.generate.GenerationContext> moduleContribution) Callback
for data module specific contributions.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.aot.BeanRegistrationAotContribution
customizeBeanRegistrationCodeFragments
-
Constructor Details
-
RepositoryRegistrationAotContribution
protected RepositoryRegistrationAotContribution(RepositoryRegistrationAotProcessor repositoryRegistrationAotProcessor) Constructs a new instance of theRepositoryRegistrationAotContribution
initialized with the given, requiredRepositoryRegistrationAotProcessor
from which this contribution was created.- Parameters:
repositoryRegistrationAotProcessor
- reference back to theRepositoryRegistrationAotProcessor
from which this contribution was created.- Throws:
IllegalArgumentException
- if theRepositoryRegistrationAotProcessor
is null.- See Also:
-
-
Method Details
-
fromProcessor
public static RepositoryRegistrationAotContribution fromProcessor(RepositoryRegistrationAotProcessor repositoryRegistrationAotProcessor) Factory method used to construct a new instance ofRepositoryRegistrationAotContribution
initialized with the given, requiredRepositoryRegistrationAotProcessor
from which this contribution was created.- Parameters:
repositoryRegistrationAotProcessor
- reference back to theRepositoryRegistrationAotProcessor
from which this contribution was created.- Returns:
- a new instance of
RepositoryRegistrationAotContribution
. - Throws:
IllegalArgumentException
- if theRepositoryRegistrationAotProcessor
is 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 aRepositoryRegistrationAotContribution
for given, requiredRegisteredBean
representing theRepository
registered in the bean registry.- Parameters:
repositoryBean
-RegisteredBean
for theRepository
; must not be null.- Returns:
- a
RepositoryRegistrationAotContribution
to contribute AOT metadata and code for theRepository
RegisteredBean
. - Throws:
IllegalArgumentException
- if theRegisteredBean
is 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 theFactoryBean
type correctly that is used to tell the outcome of theFactoryBean
. We just need to set the targetRepository
type
of theRepositoryFactoryBeanSupport
while 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) Callback
for data module specific contributions.- Parameters:
moduleContribution
-BiConsumer
used 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:
applyTo
in interfaceorg.springframework.beans.factory.aot.BeanRegistrationAotContribution
-
typeFilter
-