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

Stuart Douglas (JIRA) jira-events at lists.jboss.org
Wed May 18 07:43:01 EDT 2011


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

Stuart Douglas edited comment on CDI-129 at 5/18/11 7:41 AM:
-------------------------------------------------------------

(Opps, when I opened this the history tab was open rather than comments, and I did not realise that this had already been said)

The Final Release of JSR-299 does not define anything to do with @ApplicationScoped in 6.5.2.

@ApplicationScoped is defined in 6.7.3 and states: "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 down."

This means that @ApplicationScoped is shared over a whole ear, and is not per war (there may not even be a war in the ear).

      was (Author: swd847):
    The Final Release of JSR-299 does not define anything to do with @ApplicationScoped in 6.5.2.

@ApplicationScoped is defined in 6.7.3 and states: "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 down."

This means that @ApplicationScoped is shared over a whole ear, and is not per war (there may not even be a war in the ear).
  
> 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 (Confirmed)
>
>
> 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