[weld-issues] [JBoss JIRA] (WELD-1108) Bean with a @Named stereotype is not injected into a @Named injection point

Marko Lukša (JIRA) jira-events at lists.jboss.org
Mon Apr 23 05:31:18 EDT 2012


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

Marko Lukša resolved WELD-1108.
-------------------------------

    Resolution: Rejected


According to Pete, this is not a bug.

Here's a summary of what he says:
1. You can't put qualifiers on stereotypes.
2. @Named can't be used as a qualifier, only as a way of giving the class an EL name.


                
> Bean with a @Named stereotype is not injected into a @Named injection point
> ---------------------------------------------------------------------------
>
>                 Key: WELD-1108
>                 URL: https://issues.jboss.org/browse/WELD-1108
>             Project: Weld
>          Issue Type: Bug
>          Components: Class Beans (Managed and Session)
>    Affects Versions: 1.1.5.Final
>            Reporter: Viacheslav Kabanovich
>            Assignee: Marko Lukša
>
> 1. Create a stereotype @MyStereotype annotated @Named.
> 2. Create a bean class test.MyBean annotated @MyStereotype. Now, there is EL name 'myBean' available.
> 3. Create, in another class bean, an injection point @Inject @Named MyBean myBean.
> 4. Deploy the application
> Error: WELD-001408 Unsatisfied dependencies for type [MyBean] with qualifiers [@Named] at injection point [[field] @Named @Inject test.AnotherBean.myBean]
> 5. Add @Named to test.MyBean and deploy the application again.
> Success.
> I am not sure if it is a bug. Section 5.2. "Typesafe resolution" says that in order to be injected, the bean should have all the required qualifiers, and @Named is a required qualifier at the injection point 'myBean'. The question is, can we consider that a bean has qualifier @Named if it is annotated by a @Named stereotype? I could not find a plain statement in JSR-299 on that. However, if a stereotype A declares another stereotype B, a bean annotated with A is as good as one annotated with both A and B (section 2.7.5.1. says 'stereotype declarations are transitive'); and annotation @Named added to a stereotype A gives EL name to a bean annotated with A, as if it is annotated with @Named explicitly. Is it enough to answer 'yes' to the question above, or is it a 'jumping to conclusions' case?

--
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 weld-issues mailing list