The notes on using the CDI are as follows:
CDI extension interface (Portable Extension API)
The CDI extension interface (Portable Extension API) cannot be used with Application Server.
Notes on using the CDI with Application Server (differences from the standard specifications)
- This point describes the scope of Application Server support when you combine and use the Servlet 3.0 functionality and the CDI.
The CDI annotations can be used with Servlet, Listener, and Filter defined in web.xml, and Servlet, Listener, and Filter defined in annotations.
The CDI annotations can only be used with Servlet and Filter dynamically defined by using the contextInitialized method of javax.servlet.ServletContextListener for the Servlet listener, and the following methods of javax.servlet.ServletContext:
- addFilter(java.lang.String filterName, java.lang.Class<? extends Filter> filterClass)
- addFilter(java.lang.String filterName, java.lang.String className)
- addServlet(java.lang.String servletName, java.lang.Class<? extends Servlet> servletClass)
- addServlet(java.lang.String servletName, java.lang.String className)
The usage of the CDI annotations in Servlet, Filter, and Listener dynamically defined by using the other APIs is not supported.
- If beans.xml is allocated to the META-INF directory specified in the JavaVM class path, the classes in the JavaVM class path are not managed by the CDI.
- If beans.xml is allocated to the META-INF directory of the resource adapter (RAR), the beans.xml file is not read and the resource adapter is not recognized as a CDI module.
- If beans.xml is allocated to the META-INF directory in the JAR allocated within WEB-INF/lib of the WAR, the beans.xml file is not read and the JAR file is not recognized as a CDI module. Note that ManagedBean can be injected into the JSPs included in META-INF/resources, existing in the JAR files stored beneath WEB-INF/lib.
- The usage of @EJB, @Resource, @PersistenceContext, and @PersistenceUnit is not supported with the CDI ManagedBean.
- You cannot inject Session Beans (including the ones where the local interface is omitted) by using the CDI annotations.
- If you use the CDI annotations to inject an EJB, the error message KDJE59316-E is output and the injection operation fails.
- You cannot inject an EJB, with @Named assigned, into the JSF and JSP by using the Expression Language. If you use the Expression Language to reference an EJB for which @Named is assigned, the error message KDJE59316-E is output and the injection operation fails.
- If the @Produces annotation and @Disposes annotation are assigned with the @Dependent scope object, the producer method cannot be referenced in the same class. Also, if you create such an application, recursive injection is performed and StackOverflowException might occur.
- The @PostConstruct annotation or @PreDestroy annotation cannot be used with Beans to which the @Produces annotation or @Disposes annotation are assigned.
- An interceptor can be used with the CDI applications. However, you cannot use the EJB interceptor and CDI interceptor for the EJB at the same time. If used at the same time, the CDI interceptor is not executed.
Using the reload functionality with the applications that use the CDI
The CDI applications are reloaded for each application. The CDI applications cannot be reloaded for each WAR and JSP. Also, if Facelets is used with the JSF, the CDI applications cannot be reloaded.
Notes on the application starting performance
If the number of JAR files of beans.xml included in the CDI applications increases, the deployment time increases greatly, compared to the increment in the JAR files.
Notes on using Managed Beans
The Managed Bean instances for which the javax.enterprise.context SessionScoped annotation is specified are not stored in the explicitly-managed heap.