[cdi-dev] [JBoss JIRA] (CDI-231) Clarify if Alternatives are filtered in BeanManager#getBeans() or #resolve()

Martin Kouba (JIRA) jira-events at lists.jboss.org
Tue Jul 24 04:29:08 EDT 2012

    [ https://issues.jboss.org/browse/CDI-231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12707482#comment-12707482 ] 

Martin Kouba commented on CDI-231:

IMHO the spec is clear even without any changes...

11.3.5. Obtaining a Bean by type
The method BeanManager.getBeans() returns the set of beans which _*have the given required type and qualifiers and are available for injection*_ in the module or library containing the class into which the BeanManager was injected...

See also 5.1. Modularity and 5.1.4 Inter-module injection.

The method {{BeanManager.getBeans()}} should return all beans available for injection even those "shaded by" enabled alternatives. The method {{BeanManager.resolve()}} should only apply the ambiguous dependency resolution rules to the given set of beans. However the {{BeanManager.resolve()}} definition clarification requirement WRT CDI-227 seems legitimate.

> Clarify if Alternatives are filtered in BeanManager#getBeans() or #resolve()
> ----------------------------------------------------------------------------
>                 Key: CDI-231
>                 URL: https://issues.jboss.org/browse/CDI-231
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>          Components: Resolution
>    Affects Versions: 1.0, 1.1.EDR1
>            Reporter: Mark Struberg
>            Assignee: Pete Muir
>             Fix For: 1.1 (Proposed)
> The spec and javadoc are not really clear if the @Alternative filter defined in "5.2.1. Unsatisfied and ambiguous dependencies" is already performed in BeanManager#getBeans() or only later in BeanManager#resolve().
> Back in 2009 I did a blind test with an old Weld version which only returned @Alternatives in getBeans() and all other beans got filtered out. This seems to have changed now (since quite some time). 
> Can we make this more clear what should happen in getBeans() and what should happen in resolve()?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the cdi-dev mailing list