Marius Bogoevici commented on CDI-129:
Mark, the 6.5.2 ref is a bit confusing.
Here's what I read in my version of the spec:
The @RequestScoped, @ApplicationScoped and @SessionScoped annotations defined in Section
6.7, “Context man-
agement for built-in scopes” represent the standard scopes defined by the Java Servlets
The major complication of this item is that @ApplicationScoped and @RequestScoped are
defined in ways that do not have anything to do with the Servlet specification - e.g. they
are active for the duration of a JMS invocation, or an EJB timeout.
It is also said that
The application context is shared between all servlet requests, web service invocations,
EJB remote method invocations,
EJB asynchronous method invocations, EJB timeouts and message deliveries to message-driven
beans that execute within
the same application. The application context is destroyed when the application is shut
Furthermore, the specification uses the notion of an "application" in the sense
of "complete deployment", specifically indicating that EARs fall under this
category. This is also consistent with the Java EE 6 usage of the term.
In an application deployed as an ear, the container searches every bean archive bundled
with or referenced by the ear,
including bean archives bundled with or referenced by wars and EJB jars contained in the
ear. The bean archives might
be library jars, EJB jars, rars or war WEB-INF/classes directories.
In my opinion the connection to the Servlet spec is the offending item and this is what
should be fixed. We can introduce a WebApplication or Module scope, the latter of which
would be much more consistent (as it might, for example, apply to EJB archives as well).
introduce @EnterpriseScoped (or similar)
Project: CDI Specification Issues
Issue Type: Feature Request
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
There is currently no specified CDI scope for providing a single shared instance for a
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