[
https://issues.jboss.org/browse/WELD-907?page=com.atlassian.jira.plugin.s...
]
Gerhard Petracek reopened WELD-907:
-----------------------------------
stuart, that's irrelevant in this case.
#1 there is no producer in this case
#2 there is only one bean in the whole (demo-)app
#3 the component passed to the context implementation has to provide the correct
bean-class and qualifiers to lookup the bean again with those information.
since it looks like that it works (again) with glassfish 3.2, you can resolve it (fixed)
but not with rejected.
bean-lookup issue in Context#get(Contextual, CreationalContext)
---------------------------------------------------------------
Key: WELD-907
URL:
https://issues.jboss.org/browse/WELD-907
Project: Weld
Issue Type: Bug
Components: Scopes & Contexts
Affects Versions: 1.1.1.Final
Reporter: Gerhard Petracek
Assignee: Stuart Douglas
Fix For: 1.1.2.Final
this is a very special case which used to work before weld v1.1.1
e.g.:
Set<Bean<?>> beans1 = beanManager.getBeans(MyBean.class);
Class beanClass = beans.iterator().next().getBeanClass();
Set<Annotation> qualifiers = beans.iterator().next().getQualifiers();
Set<Bean<?>> beans2 = beanManager.getBeans(beanClass, qualifiers.toArray(new
Annotation[qualifiers.size()]));
beans1 is the same as beans2
that works without problems.
if you use the same in
Context#get(Contextual, CreationalContext)
it doesn't work. i haven't looked at the details but it might be due to the
performance optimizations.
the following example isn't that useful (so please don't ask for the reason) -
it's just the minimal code to reproduce the issue.
public <T> T get(Contextual<T> component, CreationalContext<T>
creationalContext)
{
Class beanClass = ((Bean<T>)component).getBeanClass();
Set<Annotation> qualifiers = ((Bean<T>)component).getQualifiers();
Set<Bean<?>> beans = CdiUtils.getBeanManager().getBeans(beanClass,
qualifiers.toArray(new Annotation[qualifiers.size()]));
//beans is empty
}
it isn't specified that it should work but it used to work with weld and it also
works with owb.
since there is (imo) no reason why it shouldn't work, it would be great if it gets
fixed!
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira