[weld-issues] [JBoss JIRA] Updated: (CDITCK-211) Test that beans which are @Named via a stereotype are selectable with Instance.select()

Pete Muir (JIRA) jira-events at lists.jboss.org
Fri May 20 11:26:01 EDT 2011


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

Pete Muir updated CDITCK-211:
-----------------------------

        Summary: Test that beans which are @Named via a stereotype are selectable with Instance.select()  (was: Make special note in the spec about beans that are @Named via a stereotype being unselectable with Instance.select())
    Description: 
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;

Check that it is possible to select it

  // This must not result in an UnsatisfiedDependencyException
  Foo foo = fooInstance.select(new NamedLiteral("foo")).get();

  was:
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 is an impl bug not a spec clarification :-)

> Test that beans which are @Named via a stereotype are selectable with Instance.select()
> ---------------------------------------------------------------------------------------
>
>                 Key: CDITCK-211
>                 URL: https://issues.jboss.org/browse/CDITCK-211
>             Project: CDI TCK
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>            Reporter: Shane Bryzak
>            Priority: Minor
>
> 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;
> Check that it is possible to select it
>   // This must not result in an UnsatisfiedDependencyException
>   Foo foo = fooInstance.select(new NamedLiteral("foo")).get();

--
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