[cdi-dev] [JBoss JIRA] (CDI-109) Invalid beans should not be injectable into extensions

Pete Muir (JIRA) jira-events at lists.jboss.org
Fri Aug 24 18:51:15 EDT 2012


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

Pete Muir commented on CDI-109:
-------------------------------

Issued a pull at https://github.com/jboss/cdi/pull/89 for this and CDI-245, which resolves the issue around "inject into service providers" which is was a mistake.

I haven't allowed extensions to inject other beans at runtime, that seems overly complex. If an extension wants to do something at runtime, it should define a bean that does it. The bean can inject the extension to obtain any information it needs from container initialization.

I've also left what happens when the container injects something other than the BeanManager into an observer method as undefined, as I think there is room for an implementation to innovate here. It also allows an implementation to allow this runtime, for example.
                
> Invalid beans should not be injectable into extensions
> ------------------------------------------------------
>
>                 Key: CDI-109
>                 URL: https://issues.jboss.org/browse/CDI-109
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Portable Extensions
>    Affects Versions: 1.0, 1.1.EDR
>            Reporter: John Ament
>            Assignee: Pete Muir
>            Priority: Minor
>             Fix For: 1.1 (Proposed)
>
>
> Currently, you can inject beans that may not be ready yet into the extension's call back methods.  As an example, I can inject something application scoped like this in to an extension, but it should really be throwing a definition exception (or similar):
> public void handleABD(@Observes AfterBeanDiscovery abd, MyApplicationScopedBean masb) {
> }
> Pete had noted that really the only safe thing to inject, other than the observed call back, is the bean manager.

--
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