Hi Martin,
I totally agree with you. In integrating CDI 1.2 to WebSphere Liberty profile, I interpreted the latter.

e.g. In a war with bean-discovery-mod=none, if one of its libs is a bean archive, the cdi is enabled for the war module. The servlet in this war will support injections.

However, it gives performance penalty, e.g. creating bda etc. I would like to know what the other application servers (GlassFish or WildFly) behave. It will be nice if the spec is clearer on this. I will raise a spec issue on this.
Thanks
Emily

On Tue, Aug 18, 2015 at 2:36 PM, Martin Kouba <mkouba@redhat.com> wrote:
Hi Emily,

Dne 18.8.2015 v 11:36 Emily Jiang napsal(a):
 From CDI 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.

I think it is no need to create a bda for such bean archives, which
implies JavaEE component classes cannot support injection in these
archives. These archives are ignored basically. Right?

Yes, these archives are ignored from the CDI container point of view. As regards the injection support for Java EE component classes - this is not clearly defined. 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).

I think we should check what Java EE RI (GlassFish) and other implementations (WildFly) do.


The spec does say an extension can exist in a non-bean archive but it
does not say anything about JavaEE component classes.


--
Thanks
Emily
=================
Emily Jiang
ejiang@apache.org <mailto:ejiang@apache.org>


_______________________________________________
weld-dev mailing list
weld-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev


--
Martin Kouba
Software Engineer
Red Hat, Czech Republic



--
Thanks
Emily
=================
Emily Jiang
ejiang@apache.org