[cdi-dev] [JBoss JIRA] Commented: (CDI-147) Are EJB's not deployed in a bean archive eligible for CDI injection

Pete Muir (JIRA) jira-events at lists.jboss.org
Sun Sep 18 07:43:26 EDT 2011


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

Pete Muir commented on CDI-147:
-------------------------------

On further exploration, the approach advocated about the CDI spec can potentially lead to unexpected results. Consider the situation where you have a war which is using another JSR-330 impl, such as Spring to wire up EJBs. If you add a library which has a beans.xml, offering optional CDI support, then the behaviour of the app would change, as the container would try to wire up the @Inject injection points in app using CDI, and probably fail.

A more popular option is to offer the ability to enable CDI for an entire application explicitly. In this case, any EJB would be injected. Furthermore, we could drop the requirement to include beans.xml in every archive in the app in this case.

> Are EJB's not deployed in a bean archive eligible for CDI injection
> -------------------------------------------------------------------
>
>                 Key: CDI-147
>                 URL: https://issues.jboss.org/browse/CDI-147
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>    Affects Versions: 1.0
>            Reporter: Stuart Douglas
>             Fix For: 1.1 (Proposed)
>
>
> If an EJB is deployed in an ejb-jar without a beans.xml, is this EJB eligible for CDI injection of beans deployed in other modules?
> The spec says:
> "The container performs dependency injection on all session and message-driven bean instances, even those which are not
> contextual instances."
> To me this sounds like the intent was to allow injection into EJB's looked up from JNDI, does this also mean that EJB's in non bean archives should also be injected? 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the cdi-dev mailing list