[weld-dev] archives containing a beans.xml with bean-discovery-mode=all
Martin Kouba
mkouba at redhat.com
Tue Aug 18 09:36:17 EDT 2015
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 at apache.org <mailto:ejiang at apache.org>
>
>
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
>
--
Martin Kouba
Software Engineer
Red Hat, Czech Republic
More information about the weld-dev
mailing list