[cdi-dev] [JBoss JIRA] (CDI-129) Clarify behaviour of @ApplicationScoped in EARs

Pete Muir (JIRA) jira-events at lists.jboss.org
Mon Oct 22 08:52:03 EDT 2012


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

Pete Muir commented on CDI-129:
-------------------------------

In an attempt to summarise (which I'm sure will get me accused of bias, but I'm trying not to be!)

h3. Viability of solution

(a) it is technically possible to consistently and sanely provide per-EAR, as this is what Weld does. TODO, add notes
(b) it is technically possible to consistently and sanely provide per-WAR, as this is what OWB does. TODO, add notes

h3. Intent

The CDI 1.0 spec intended @ApplicationScoped to be per-EAR (as clarified by Gavin King, CDI 1.0 spec lead). Java EE describes an EAR as an "application" (as clarified by Bill Shannon, Java EE spec lead).

h3. Backwards compatibility to Java EE app servers

All certified Java EE app servers provide @ApplicationScoped as per-EAR. 

Note that this is only backwards compatibility the Java EE EG and JCP care about.

h3. Backwards compatibility to non-Java EE certified environments

(a) Weld deploys to servlet containers, however this is not relevant to this discussion. We have never seriously investigated using Weld in a Java EE 5 app server.
(b) OWB deploys to Java EE 5 application servers, where it provides @ApplicationScoped per WAR.

h3. Community

The community is fairly evenly split between per-EAR and per-WAR, with 53% choosing per-EAR and 47% choosing per-WAR in a poll.
                
> Clarify behaviour of @ApplicationScoped in EARs
> -----------------------------------------------
>
>                 Key: CDI-129
>                 URL: https://issues.jboss.org/browse/CDI-129
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>          Components: Contexts
>    Affects Versions: 1.0
>            Reporter: Mark Struberg
>            Assignee: Pete Muir
>             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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the cdi-dev mailing list