[cdi-dev] Clarification for manually resolving 'Instance'

Mark Struberg struberg at yahoo.de
Sat Sep 24 06:41:42 EDT 2011


Hi!

Currently both Weld and OWB blow up if I resolve an unparameterized 'Instance' object.

beanManager.getBeans(Instance.class);

will return zero beans, so there is no way to call beanManager.getReference ...


Of course with a little trick I was able to get it working in OWB:
Type instanceType = new TypeLiteral<Instance<Object>>(){}.getType();
Set<Bean<?>> beans = beanManager.getBeans(instanceType);

(did not test it on Weld yet)


My question is which behaviour is expected.
This question could maybe be generalized to: how do beans for parameterized types need to get handled?


LieGrue,
strub



More information about the cdi-dev mailing list