[cdi-dev] [JBoss JIRA] Updated: (CDI-34) Make special note in the spec about beans that are @Named via a stereotype being unselectable with Instance.select()

Pete Muir (JIRA) jira-events at lists.jboss.org
Wed Jan 26 19:27:51 EST 2011


     [ https://issues.jboss.org/browse/CDI-34?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pete Muir updated CDI-34:
-------------------------

    Fix Version/s: TBD


> Make special note in the spec about beans that are @Named via a stereotype being unselectable with Instance.select()
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: CDI-34
>                 URL: https://issues.jboss.org/browse/CDI-34
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Concepts
>    Affects Versions: 1.0
>            Reporter: Shane Bryzak
>            Priority: Minor
>             Fix For: TBD
>
>
> For example, say we have the following bean:
> public @Model class Foo implements IFoo { }
> And we have the following injection point within another bean:
>   @Inject Instance<Foo> fooInstance;
> It is not possible to select Foo via name using the Instance:
>   // This results in an UnsatisfiedDependencyException
>   Foo foo = fooInstance.select(new NamedLiteral("foo")).get();
> Instead, Foo must be annotated directly with the @Named annotation itself:
> /*
>  * This Foo can be selected by name
>  */
> public @Named @RequestScoped Foo implements IFoo { }
> This special case might be worthwhile mentioning in the next revision of the spec.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the cdi-dev mailing list