]
Martin Kouba commented on CDI-556:
----------------------------------
I think we should also raise a Java EE spec issue on this.
JavaEE component classes injection support mode
-----------------------------------------------
Key: CDI-556
URL:
https://issues.jboss.org/browse/CDI-556
Project: CDI Specification Issues
Issue Type: Clarification
Components: Java EE integration
Affects Versions: 1.2.Final
Environment: all
Reporter: Emily Jiang
From CDI 1.2 spec,
An archive which:
• contains a beans.xml file with the bean-discovery-mode of none, or,
• contains an extension and no beans.xml file
is not a bean archive.
Do JavaEE component classes support injections in the non bean archives? The spec is not
clear on this.
Jozef said:
Java EE spec states in "EE.5.2.5
Annotations and Injection":
"The component classes listed in Table EE.5-1 with support level Standard all
support Java EE resource injection, as well as PostConstruct and PreDestroy callbacks. In
addition, if CDI is enabled—which it is by default—these classes also support CDI
injection, as described in Section EE.5.24, Support for Dependency Injection, and the use
of interceptors."
However, it is not clear what "if CDI is enabled" means. One can argue that
"CDI is enabled" if the component class resides in a bean archive. The other
interpretation (the one I personally prefer) might be that "CDI is enabled" if a
CDI container is initialized for the application (i.e. there's at least one CDI bean
archive).
The CDI spec needs to be clear on this.