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

Mark Struberg (JIRA) jira-events at lists.jboss.org
Thu Mar 22 06:29:47 EDT 2012


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

Mark Struberg commented on CDI-220:
-----------------------------------

Well Martin, I fear the CDI spec is not 100% clear as it says that session beans also must be treated as managed beans... It would be more clear if it would state 'Managed CDI bean' or anything like that.

Look at "3.1.1. Which Java classes are managed beans?"
> A top-level Java class is a managed bean if it is defined to be a managed bean by any other Java EE specification, 
Which a session bean certainly is, isn't?

hmm but it also states:
> It is not annotated with an EJB component-defining annotation or declared as an EJB bean class in ejb-jar.xml.

The confusion gets deeper because EJBs must also be held as Bean<T> in the BeanManager as required by the spec.


JSR-316 (EE umbrella) btw seems to catched that as well and explicitly ranted about it ;)
> "CDI-style managed beans"
> We use this term to refer to classes that become managed beans per the rules 
> in the CDI specification (JSR-299), thus excluding managed beans declared using 
> the @ManagedBean annotation as well as EJB session beans, both of which would 
> be managed beans even in the absence of CDI.

*scratches his head*
                
> 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