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

Mark Struberg (JIRA) jira-events at lists.jboss.org
Fri May 13 16:18:50 EDT 2011


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

Mark Struberg commented on CDI-129:
-----------------------------------

It might well be that the spec is contradicting. But however we turn this, the fact remains that there are 2 different scopes needed. 1 Webapplication scope and 1 ear scope. 

I doubt that the original intention of @ApplicationScoped was for EAR usage! It got added way later, but the historic evolution of the spec, and the fact that it heavily and easily integrates with EJBs allows that we just use EJBs for those cases you mentioned. We can still use EJBs for those things. 

If we would interpret @ApplicationScoped your way, then it would behave *heavily* different depending if the war gets used/tested standalone or as part of an EAR. That sounds just plain wrong imo. 

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?


> 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