|
22 | 22 | import java.util.Optional;
|
23 | 23 | import java.util.Set;
|
24 | 24 | import java.util.function.Function;
|
25 |
| -import java.util.regex.Pattern; |
26 | 25 | import java.util.stream.Collectors;
|
27 | 26 |
|
28 | 27 | import javax.annotation.Nullable;
|
|
33 | 32 | import org.springframework.core.env.Environment;
|
34 | 33 | import org.springframework.core.io.ResourceLoader;
|
35 | 34 | import org.springframework.core.type.classreading.MetadataReaderFactory;
|
36 |
| -import org.springframework.core.type.filter.RegexPatternTypeFilter; |
37 | 35 | import org.springframework.core.type.filter.TypeFilter;
|
38 | 36 | import org.springframework.data.util.Streamable;
|
39 | 37 | import org.springframework.util.Assert;
|
|
51 | 49 | @RequiredArgsConstructor
|
52 | 50 | public class CustomRepositoryImplementationDetector {
|
53 | 51 |
|
54 |
| - private static final String CUSTOM_IMPLEMENTATION_RESOURCE_PATTERN = "**/*%s.class"; |
| 52 | + private static final String CUSTOM_IMPLEMENTATION_RESOURCE_PATTERN = "**/%s.class"; |
55 | 53 | private static final String AMBIGUOUS_CUSTOM_IMPLEMENTATIONS = "Ambiguous custom implementations detected! Found %s but expected a single implementation!";
|
56 | 54 |
|
57 | 55 | private final @NonNull MetadataReaderFactory metadataReaderFactory;
|
@@ -106,15 +104,14 @@ Set<BeanDefinition> findCandidateBeanDefinitions(String className, Iterable<Stri
|
106 | 104 | Iterable<TypeFilter> excludeFilters) {
|
107 | 105 |
|
108 | 106 | // Build pattern to lookup implementation class
|
109 |
| - Pattern pattern = Pattern.compile(".*\\." + className); |
110 | 107 |
|
111 | 108 | // Build classpath scanner and lookup bean definition
|
112 | 109 | ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false,
|
113 | 110 | environment);
|
114 | 111 | provider.setResourceLoader(resourceLoader);
|
115 | 112 | provider.setResourcePattern(String.format(CUSTOM_IMPLEMENTATION_RESOURCE_PATTERN, className));
|
116 | 113 | provider.setMetadataReaderFactory(metadataReaderFactory);
|
117 |
| - provider.addIncludeFilter(new RegexPatternTypeFilter(pattern)); |
| 114 | + provider.addIncludeFilter((reader, factory) -> true); |
118 | 115 |
|
119 | 116 | excludeFilters.forEach(it -> provider.addExcludeFilter(it));
|
120 | 117 |
|
|
0 commit comments