@ -328,6 +328,7 @@ In this case we use the repository domain type to identify the name of the index
@@ -328,6 +328,7 @@ In this case we use the repository domain type to identify the name of the index
Exposing invocation metadata is costly, hence it is disabled by default.
To access `RepositoryMethodContext.getContext()` you need to advise the repository factory responsible for creating the actual repository to expose method metadata.
Customizing the javadoc:org.springframework.data.repository.core.support.RepositoryFactorySupport[repository factory] through javadoc:org.springframework.data.repository.core.support.RepositoryFactoryCustomizer[] provides direct access to components involved with repository instance creation.
This mechanism is useful when you want to adjust selected aspects of proxy creation without introducing a fully custom repository factory bean.
The following example, demonstrates registering additional listeners and proxy advisors:
A `RepositoryFactoryCustomizer` is associated with a particular repository factory bean, ideally through `BeanPostProcessor` so that only specific repositories are affected.
Note that customizer beans are not applied automatically to prevent unwanted wiring that become especially relevant in multi-repository arrangements or when using multiple Spring Data modules.
The most powerful approach to customize repository creation is to provide a custom repository factory bean, typically a subclass of javadoc:org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport[], javadoc:org.springframework.data.repository.core.support.TransactionalRepositoryFactoryBeanSupport[] or the store-specific repository factory bean.
Customizing the repository factory bean allows you to change repository creation entirely with full access to the underlying repository factory.
Note that this approach requires the most effort and is typically only needed when you want to change core aspects of repository creation.
Also, you need to take in consideration repository metadata derivation that is used to identify query methods, base implementation methods and custom implementations.
The following summary outlines the key aspects:
* `repositoryBaseClass`: The repository base class defines which methods are implemented by the base class and which methods require additional handling through aspects or custom implementations.
* `repositoryFragmentsContributor`: A javadoc:org.springframework.data.repository.core.support.RepositoryFragmentsContributor[] allows contributions to repository composition after all standard fragments have been collected.
Store modules use this mechanism to add features such as Querydsl or Query-by-Example support.
It also serves as an SPI for third-party extensions.
* `exposeMetadata`: Controls whether <<expose-repository-metadata,invocation metadata>> is available through `RepositoryMethodContext.getContext()`.
@ -114,8 +115,7 @@ public class DefaultRepositoryConfiguration<T extends RepositoryConfigurationSou
@@ -114,8 +115,7 @@ public class DefaultRepositoryConfiguration<T extends RepositoryConfigurationSou
@ -166,8 +166,7 @@ public class DefaultRepositoryConfiguration<T extends RepositoryConfigurationSou
@@ -166,8 +166,7 @@ public class DefaultRepositoryConfiguration<T extends RepositoryConfigurationSou
}
@Override
@org.jspecify.annotations.NonNull
publicStringgetResourceDescription(){
public@NonNullStringgetResourceDescription(){
returnString.format("%s defined in %s",getRepositoryInterface(),configurationSource.getResourceDescription());