Set<Bean<?>> beans = beanManager.getBeans(type, qualifiers.toArray(new Annotation[qualifiers.size()]));
for (Bean<?> bean : beans) {
if (bean.getBeanClass().isAnnotationPresent(Microservice.class) && !(bean instanceof MicroserviceProxyBean)) {
final Bean<?> theBean = beanManager.resolve(Collections.singleton(bean));
final Microservice microserviceAnnotation = theBean.getBeanClass().getAnnotation(Microservice.class);
<BUG>if (name == null || (microserviceAnnotation.value().isEmpty() && name.equals(theBean.getName())) ||
(!microserviceAnnotation.value().isEmpty() && name.equals(microserviceAnnotation.value()))) {

return Collections.singleton(beanManager.getReference(theBean, type, beanManager.createCreationalContext(theBean)));

} else if (type.isInterface() && !name.equals(theBean.getName())) {
if (qualifiers.stream().filter(q -> q.annotationType().getName().equals("Default")).count() == 0) { // we have a qualifier match
return Collections.singleton(beanManager.getReference(theBean, type, beanManager.createCreationalContext(theBean)));
</BUG>
}

Set<Bean<?>> beans = beanManager.getBeans(type, qualifiers.toArray(new Annotation[qualifiers.size()]));
for (Bean<?> bean : beans) {
if (bean.getBeanClass().isAnnotationPresent(Microservice.class) && !(bean instanceof MicroserviceProxyBean)) {
final Bean<?> theBean = beanManager.resolve(Collections.singleton(bean));
final Microservice microserviceAnnotation = theBean.getBeanClass().getAnnotation(Microservice.class);
if (name != null) {
if ((!microserviceAnnotation.value().isEmpty() && name.equals(microserviceAnnotation.value())) ||
(microserviceAnnotation.value().isEmpty() && name.equals(theBean.getName()))) {
matchingBeansByName.add(beanManager.getReference(theBean, type, beanManager.createCreationalContext(theBean)));
} else if (type.isAssignableFrom(theBean.getBeanClass())) {
final Set<Annotation> qualifiersToCompare = new HashSet<>(theBean.getQualifiers());
qualifiers.stream().forEach(qualifiersToCompare::remove);
if (qualifiersToCompare.size() == 0) {
matchingBeansByType.add(beanManager.getReference(theBean, type, beanManager.createCreationalContext(theBean)));
