[cdi-dev] [JBoss JIRA] Commented: (CDI-129) introduce @EnterpriseScoped (or similar)

Pete Muir (JIRA) jira-events at lists.jboss.org
Mon May 16 09:06:01 EDT 2011

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

Pete Muir commented on CDI-129:

I can say with 99.9% certainty that Gavin (at least) intended the @ApplicationScoped to be "ear scoped" when deploying inside an EAR. Unfortunately we can't easily go back and check.

Mark, can you explain what you mean by it behaving differently in this situation. As I see it, it actually is more consistent to make it work like this.


Btw, it IS possible to fulfil the the spec. In OWB we handle JMS, and quartzed jobs, etc as own 'applications' inside the EAR. So they get an own BeanManager and can even have their own Extensions. See what I mean?

this does seem somewhat orthogonal to the question. In Weld an EJB jar would also get it's own BeanManager (and it should get it's own extensions, this is a bug in Weld right now) but it shares the Application context with all other modules in the application. So unless you can clarify what you mean here, I think we can ignore this.

Marius, thanks for digging up those references, I think with those we can be quite confident that that the spec intends @ApplicationScoped to be "ear scoped" and that the reference to the Servlet spec was a mistake. In particular the comment "in an application deployed as an ear" indicates that the CDI spec regards an EAR as an application, and that coupled with the comment "the application context is shared ... within the same application" does indicate that the context spans the entire ear. To me, this is a stronger statement than "represent the standard scopes defined by the Java Servlets specification" which seems somewhat more descriptive.

Mark, happy to consider adding an @WebApplicationScoped, and we should definitely clarify what @ApplicationScoped means.

> introduce @EnterpriseScoped (or similar)
> ----------------------------------------
>                 Key: CDI-129
>                 URL: https://issues.jboss.org/browse/CDI-129
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Contexts
>    Affects Versions: 1.0
>            Reporter: Mark Struberg
>             Fix For: 1.1 (Proposed)
> Since @ApplicationScoped currently is defined in 6.5.2 as to be 'like in the Servlet specification' this means that you will get a new instance for every WebApplication (WAR file).
> There is currently no specified CDI scope for providing a single shared instance for a whole EAR.
> We could (ab-)use @Singleton for that, but this is currently not well defined at all.
> Alternatively we could introduce an own new annotation like @EnterpriseScoped or likes. 

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