[weld-issues] [JBoss JIRA] Resolved: (WELD-907) bean-lookup issue in Context#get(Contextual, CreationalContext)
Stuart Douglas (JIRA)
jira-events at lists.jboss.org
Wed Jun 22 21:15:23 EDT 2011
[ https://issues.jboss.org/browse/WELD-907?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stuart Douglas resolved WELD-907.
---------------------------------
Resolution: Done
> 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
More information about the weld-issues
mailing list