/** * Tries to detect a custom implementation for a repository bean by classpath scanning. * * @param lookup must not be {@literal null}. * @return the {@code AbstractBeanDefinition} of the custom implementation or {@literal null} if none found. */ public Optional<AbstractBeanDefinition> detectCustomImplementation(ImplementationLookupConfiguration lookup) { Assert.notNull(lookup, "ImplementationLookupConfiguration must not be null!"); Set<BeanDefinition> definitions = implementationCandidates.getOptional() .orElseGet(() -> findCandidateBeanDefinitions(lookup)).stream() // .filter(lookup::matches) // .collect(StreamUtils.toUnmodifiableSet()); return SelectionSet // .of(definitions, c -> c.isEmpty() ? Optional.empty() : throwAmbiguousCustomImplementationException(c)) // .filterIfNecessary(lookup::hasMatchingBeanName) // .uniqueResult() // .map(AbstractBeanDefinition.class::cast); }