Unable to use BeanManager.getReference() to find a bean by its Interface in EAP 6.4
Hi,
I'm working on migrating our JBoss 6.1.0.Final system to EAP 6.4, and
I'm having a problem with using the BeanManager to find beans by using the Interface the bean implements.
This is working fine with JBoss 6.1 but I am unable to make it work with EAP 6.4.
Given
@Local
public interface Ia {
}
@Stateless
public class A implements Ia {
}
We are calling the beanManager like this:
Set<Bean<?>> beans = beanManager.getBeans(Ia.class);
Bean<?> bean = beanManager.resolve(beans);
CreationalContext<?> context = beanManager.createCreationalContext(bean);
beanManager.getReference(bean, beanClass, context);
and get back a null.
Debugging the code I find that it boils down to this piece of code in the Reflections class:
public boolean matches(TypeHolder otherTypeHolder) {
return getBoxedRawType().equals(otherTypeHolder.getBoxedRawType()) && areActualTypeArgumentsAssignableFrom(otherTypeHolder.getActualTypeArguments());
}
where I see ' (java.lang.Class
and of course not matching,
I'm pretty new to CDI so I'm hoping there is an easy answer?
Thanks
George