diff --git a/src/main/asciidoc/repositories.adoc b/src/main/asciidoc/repositories.adoc
index 2edeb8c6f..da1170c9a 100644
--- a/src/main/asciidoc/repositories.adoc
+++ b/src/main/asciidoc/repositories.adoc
@@ -749,10 +749,18 @@ Each Spring Data module includes a `repositories` element that lets you define a
----
====
-In the preceding example, Spring is instructed to scan `com.acme.repositories` and all its sub-packages for interfaces extending `Repository` or one of its sub-interfaces. For each interface found, the infrastructure registers the persistence technology-specific `FactoryBean` to create the appropriate proxies that handle invocations of the query methods. Each bean is registered under a bean name that is derived from the interface name, so an interface of `UserRepository` would be registered under `userRepository`. The `base-package` attribute allows wildcards so that you can define a pattern of scanned packages.
+In the preceding example, Spring is instructed to scan `com.acme.repositories` and all its sub-packages for interfaces extending `Repository` or one of its sub-interfaces.
+For each interface found, the infrastructure registers the persistence technology-specific `FactoryBean` to create the appropriate proxies that handle invocations of the query methods.
+Each bean is registered under a bean name that is derived from the interface name, so an interface of `UserRepository` would be registered under `userRepository`.
+Bean names for nested repository interfaces are prefixed with their enclosing type name.
+The `base-package` attribute allows wildcards so that you can define a pattern of scanned packages.
==== Using filters
-By default, the infrastructure picks up every interface extending the persistence technology-specific `Repository` sub-interface located under the configured base package and creates a bean instance for it. However, you might want more fine-grained control over which interfaces have bean instances created for them. To do so, use `` and `` elements inside the `` element. The semantics are exactly equivalent to the elements in Spring's context namespace. For details, see the link:{spring-framework-docs}/core.html#beans-scanning-filters[Spring reference documentation] for these elements.
+By default, the infrastructure picks up every interface extending the persistence technology-specific `Repository` sub-interface located under the configured base package and creates a bean instance for it.
+However, you might want more fine-grained control over which interfaces have bean instances created for them.
+To do so, use `` and `` elements inside the `` element.
+The semantics are exactly equivalent to the elements in Spring's context namespace.
+For details, see the link:{spring-framework-docs}/core.html#beans-scanning-filters[Spring reference documentation] for these elements.
For example, to exclude certain interfaces from instantiation as repository beans, you could use the following configuration:
diff --git a/src/main/java/org/springframework/data/repository/config/DefaultImplementationLookupConfiguration.java b/src/main/java/org/springframework/data/repository/config/DefaultImplementationLookupConfiguration.java
index dfd1dac05..c321a6d60 100644
--- a/src/main/java/org/springframework/data/repository/config/DefaultImplementationLookupConfiguration.java
+++ b/src/main/java/org/springframework/data/repository/config/DefaultImplementationLookupConfiguration.java
@@ -56,7 +56,8 @@ class DefaultImplementationLookupConfiguration implements ImplementationLookupCo
this.config = config;
this.interfaceName = interfaceName;
- this.beanName = Introspector.decapitalize(getLocalName(interfaceName).concat(config.getImplementationPostfix()));
+ this.beanName = Introspector
+ .decapitalize(ClassUtils.getShortName(interfaceName).concat(config.getImplementationPostfix()));
}
/*
@@ -144,7 +145,7 @@ class DefaultImplementationLookupConfiguration implements ImplementationLookupCo
String localName = getLocalName(beanClassName);
return localName.equals(getImplementationClassName()) //
- && getBasePackages().stream().anyMatch(it -> beanPackage.startsWith(it));
+ && getBasePackages().stream().anyMatch(beanPackage::startsWith);
}
private String getLocalName(String className) {
@@ -159,7 +160,6 @@ class DefaultImplementationLookupConfiguration implements ImplementationLookupCo
MetadataReader reader = getMetadataReaderFactory().getMetadataReader(beanClassName);
return filters.stream().anyMatch(it -> matches(it, reader));
-
} catch (IOException o_O) {
return true;
}
diff --git a/src/test/java/org/springframework/data/repository/cdi/CdiRepositoryBeanUnitTests.java b/src/test/java/org/springframework/data/repository/cdi/CdiRepositoryBeanUnitTests.java
index 96733586d..9193a8b98 100755
--- a/src/test/java/org/springframework/data/repository/cdi/CdiRepositoryBeanUnitTests.java
+++ b/src/test/java/org/springframework/data/repository/cdi/CdiRepositoryBeanUnitTests.java
@@ -131,33 +131,24 @@ class CdiRepositoryBeanUnitTests {
@Test // DATACMNS-322
void createsPassivationId() {
- CdiRepositoryBean bean = new DummyCdiRepositoryBean<>( //
- SINGLE_ANNOTATION, //
- SampleRepository.class, //
- beanManager //
+ CdiRepositoryBean bean = new DummyCdiRepositoryBean<>(SINGLE_ANNOTATION, SampleRepository.class,
+ beanManager
);
assertThat(bean.getId()).isEqualTo(PASSIVATION_ID);
}
- @Test // DATACMNS-764
+ @Test // DATACMNS-764, DATACMNS-1754
void passesCorrectBeanNameToTheImplementationDetector() {
CustomRepositoryImplementationDetector detector = mock(CustomRepositoryImplementationDetector.class);
- CdiRepositoryBean bean = new CdiRepositoryBean( //
- SINGLE_ANNOTATION, //
- SampleRepository.class, //
- beanManager, //
- Optional.of(detector) //
- ) {
+ CdiRepositoryBean bean = new CdiRepositoryBean(SINGLE_ANNOTATION,
+ SampleRepository.class, beanManager, Optional.of(detector)) {
@Override
- protected SampleRepository create( //
- CreationalContext creationalContext, //
- Class repositoryType, //
- Optional