[cdi-dev] [JBoss JIRA] (CDI-177) Clarify how default bean EL name and @Named qualifier with no value at injection point are related
Martin Kouba (JIRA)
jira-events at lists.jboss.org
Thu Mar 8 11:05:36 EST 2012
[ https://issues.jboss.org/browse/CDI-177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675207#comment-12675207 ]
Martin Kouba commented on CDI-177:
----------------------------------
To sum it up:
# A bean may have an EL name (2.5. Bean EL names)
# EL name is declared with the @Named qualifier (2.5. Bean EL names)
# If the @Named annotation does not specify the value member, the EL name is defaulted (2.5. Bean EL names)
# The defaulted name is used in typesafe resolution: "If an injected field declares a @Named annotation that does not specify the value member, the name of the field is assumed." and the qualifier is changed to @Named(DEFAULT_NAME)(3.13. The qualifier @Named at injection points)
# However in case of @Named is used on stereotype only EL name is defaulted
So if I understand it correctly the only clarification required for "2.5. Bean EL names" is: "If a bean declares @Named qualifier and no EL name is explicitly specified, the default EL name is assigned, and the qualifier is @Named(value=DEFAULT_NAME).".
Otherwise a bean with the @Named annotation that does not specify the value member could not be resolved - see example below.
{code}
@Named
public class Ant {}
public class AntHill {
@Inject
@Named // -> @Named("ant") --> UnsatisfiedResolutionException
private Ant ant;
}
{code}
> Clarify how default bean EL name and @Named qualifier with no value at injection point are related
> --------------------------------------------------------------------------------------------------
>
> Key: CDI-177
> URL: https://issues.jboss.org/browse/CDI-177
> Project: CDI Specification Issues
> Issue Type: Clarification
> Affects Versions: 1.0
> Reporter: Martin Kouba
> Fix For: 1.1 (Proposed)
>
>
> Related CDI 1.0 spec chapters:
> *2.5.2 Default bean EL names*
> *3.11 The qualifier @Named at injection points*
--
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