[cdi-dev] [JBoss JIRA] Commented: (CDI-129) introduce @EnterpriseScoped (or similar)
Pete Muir (JIRA)
jira-events at lists.jboss.org
Mon May 16 11:49:01 EDT 2011
[ https://issues.jboss.org/browse/CDI-129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602334#comment-12602334 ]
Pete Muir commented on CDI-129:
Mark, it's *not* "absolutely clear" from the CDI specification that this was the intent, if it were we wouldn't even be having this discussion ;-) We also can't base decisions on you saying "it's absolutely clear to me", we need to base them on facts ;-). So we have to leave aside such subjective statements.
I understand the concerns about the behaviour changing between war and ears for some who have interpreted the spec one way, however this runs both ways. So this argument is essentially nullified in this discussion (an app which assumed one will stop working when we require the other).
So far, I believe the case for it being interpreted as war scoped are
a) 2.4.1 "The @RequestScoped, @ApplicationScoped and @SessionScoped annotations defined in Section 6.7, “Context management for built-in scopes” represent the standard scopes defined by the Java Servlets specification."
b) That other specs in Java EE (namely JSF, JAX-RS, JAX-WS) refer to the "application scope" as scoped to the war (could you provide references to their specs for this)
and as ear scoped
a) that the spec describes an ear as an application, and says that the application context is shared across an application
So to summarize:
* the spec is clear that the application context should be shared across the "application"
* the confusion is around what "application" means in the context of an ear
* in one place the CDI spec mentions that the scopes "represent" those from the servlet spec, implying that the application means war scoped
* in another place the CDI spec mentions that the ear represents the application.
I think we need to gather two more opinions:
* what was the original intent (I'll ping Gavin)
* how does Java EE define "application" in an ear (I'll ping Linda and Bill)
Mark, is this a fair summary from your side of the argument? I want us to agree on a summary so that we can move forward with a discussion about which course to take, rather than get stuck in debating the spec ;-)
> 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