[
https://issues.jboss.org/browse/CDI-129?page=com.atlassian.jira.plugin.sy...
]
Pete Muir commented on CDI-129:
-------------------------------
In this comment I'll try to go through the points from Mark and Jozef, and add some
more facts that I have. I'll then do a separate comment with my opinion :-)
{quote}
... beans that execute within the same application.
Too bad
it's neither in the CDI nor the EE spec defined what they mean with application. Both
sometimes refer to web-applications and sometimes to enterprise-applications. It's
just not clear.
{quote}
I previously asked Bill Shannon and Linda DeMichiel for a clarification on this. Bill
said:
{quote}
There may be places where we don't use the terminology as precisely as we should, but
I think Chapter EE.8 of the platform spec makes it clear that an ear file is a single Java
EE application.
{quote}
So, whilst it may not be clear, the official line is that an "application" is an
ear, if ear is used.
{quote}
Afair it was 2 options:
Option a.) just disallow @Specializes and @Alternatives for all beans defined in a shared
jar. Regardless of it's scope.
Option b.) inject only beans defined in the shared jar into another bean of a shared jar.
E.g. MailService would always get an instance of A injected. Imo this is pretty crucial as
@Inject X x; in a JSF backing bean would give you a different contextual instance (even of
a totally different type) than the same code @Inject X x; in the MailService.
{quote}
We discussed this at the CDI EG meeting and the consensus was that option B is correct, as
the injected instance depends on how the beans resolve, and thus getting a different
contextual when a different bean resolves is expected.
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