diff --git a/service/registry/src/main/java/io/helidon/service/registry/Bindings.java b/service/registry/src/main/java/io/helidon/service/registry/Bindings.java index 4f3eaee232b..82da5daeb12 100644 --- a/service/registry/src/main/java/io/helidon/service/registry/Bindings.java +++ b/service/registry/src/main/java/io/helidon/service/registry/Bindings.java @@ -161,7 +161,7 @@ private DependencyBinding(CoreServiceRegistry registry, ServiceInfo serviceInfo, .build(); } - public List descriptors() { + List descriptors() { return serviceInfos; } @@ -269,19 +269,12 @@ private List managers(List serviceInfos) { private void discoverBinding() { // lookup services, exclude ourselves (when doing chained injection, we lookup by weight) - List found = registry.lookupServices(lookup) + // we need all service descriptors, as a service may not yield a service + // (such as optional suppliers, ServicesFactory etc.), so we use the next one + this.serviceInfos = registry.lookupServices(lookup) .stream() .filter(it -> it != serviceInfo) .collect(Collectors.toList()); - if (found.isEmpty() && (dependency.cardinality() == DependencyCardinality.REQUIRED)) { - throw new ServiceRegistryException("There is no service in registry that satisfied this dependency: " - + dependency); - } - - // we need all service descriptors, as a service may not yield a service - // (such as optional suppliers, ServicesFactory etc.), so we use the next one - - this.serviceInfos = found; } private static class DependencySupplier implements Supplier {