[cdi-dev] [JBoss JIRA] (CDI-220) behaviour of CDI bean @Specializes session bean is undefined

Martin Kouba (JIRA) jira-events at lists.jboss.org
Thu Mar 22 04:51:47 EDT 2012

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

Martin Kouba commented on CDI-220:

Section 3.1.4. Specializing a managed bean states:
"If a bean class of a managed bean X is annotated @Specializes, then the bean class of X must directly extend the bean class of another managed bean Y. Then X directly specializes Y, as defined in Section 4.3, “Specialization”.
*If the bean class of X does not directly extend the bean class of another managed bean, the container automatically detects the problem and treats it as a definition error.*"

So your code (Trakehner = managed bean, Horse = session bean) should result in definition error.

> behaviour of CDI bean @Specializes session bean is undefined
> ------------------------------------------------------------
>                 Key: CDI-220
>                 URL: https://issues.jboss.org/browse/CDI-220
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>          Components: Java EE integration
>    Affects Versions: 1.0, 1.1.EDR1
>            Reporter: Mark Struberg
>             Fix For: TBD
> The current spec doesn't define what should happen if a CDI bean @Specializes a session bean, e.g.
> @Stateless
> public class Horse {..}
> @ApplicationScoped @Specializes
> public class Trakehner extends Horse {..}
> Section 3.2.4 explicitely forbids the other way around. I think we should also treat the above case as error.
> Otherwise we would end up getting different results whether we use @Inject or @EJB to inject a Horse.

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