[cdi-dev] [JBoss JIRA] (CDI-245) Promote the right way how extensions should communicate with each other during container initialization

Mark Struberg (JIRA) jira-events at lists.jboss.org
Sat Aug 25 03:38:16 EDT 2012


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

Mark Struberg commented on CDI-245:
-----------------------------------

>  as extensions are not defined as beans
au contraire! Extensions are exactly defined as @ApplicationScoped @Default beans in CDI-1.0:

{quote}
An extension is a service provider of the service javax.enterprise.inject.spi.Extension declared in META-INF/services. ...

For each service provider, the container must provide a bean of scope @ApplicationScoped and qualifier @Default,
{quote}

I'm also not sure if the re-wording is clear enough. You changed:
- If other beans are injected into service providers
+ If other beans are injected into an extension's observer methods

But this leaves out direct injection into CDI-Extensions

{code}
public class BrokenExtension implements Extension {
  private @Inject OtherExtension notAllowed;

  private @Inject BeanManager holymolyIsThisAllowedQuestionmark;
}
{code}
The question whether the direct injection of a BeanManager into an Extension is ok for CDI-1.0 remains. Not that I think this is supported by neither Weld nor OWB... ;)


I also completely miss the change where you define firing CDI lifecycle events as non-portable.
                
> Promote the right way how extensions should communicate with each other during container initialization
> -------------------------------------------------------------------------------------------------------
>
>                 Key: CDI-245
>                 URL: https://issues.jboss.org/browse/CDI-245
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>    Affects Versions: 1.0, 1.1.EDR
>            Reporter: Martin Kouba
>            Assignee: Pete Muir
>             Fix For: 1.1.PRD
>
>
> This is not clear right now. The spec allows (does not forbid) extensions to fire regular events via {{BeanManager}} and I believe this should be _the right way_. See also CDI-109 discussion. However we should also state that extensions _may not fire container lifecycle events_ as this could lead to unexpected results (and it's pretty broken imho).

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