[
https://issues.jboss.org/browse/CDI-129?page=com.atlassian.jira.plugin.sy...
]
Jozef Hartinger commented on CDI-129:
-------------------------------------
You are mixing way too many things here. Firstly, here is how the modularity work in CDI:
Let's have two bean archives: A and B. Module A is accessible from B (A it might
represent a shared library in an ear). Module B is not accessible from A (B it might
represent a web app).
Let A define the following classes:
{code:JAVA}
public interface X {}
public class A implements X {}
{code}
Let B define the following class:
{code:JAVA}
@Alternative
public class B extends A {}
{code}
Class B is an enabled alternative in module B. Alternatively, B may be a specializing
class (not alternative at all).
Now suppose there are classes Foo and Bar, each of them injecting X, Foo is located in
module A and Bar is located in module B.
If Foo invokes a method on the injected instance, it will always be invoked on an instance
of A (and not instance of B). if Bar invokes a method on the injected instance, it will
always be invoked on an instance of B. This is regardless of scope of bean A and B (no
matter whether client proxies are used or not).
There is no randomness and there is not ClassNotFoundException.
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