Configuring Liberty for Contexts and Dependency Injection 1.2

You can configure Liberty for the Contexts and Dependency Injection (CDI) 1.2 feature, which provides full support for the Contexts and Dependency Injection 1.2 specification.

About this task

To configure the Liberty server to run an application that is enabled for CDI 1.2, you must set the <cdi-1.2> feature.

Procedure

Update the server.xml file to add the <cdi-1.2> feature. For example:
<featureManger>
	<feature>cdi-1.2</feature>
</featureManger>
Note:
  • You can use other Java™ EE 7 features, such as jsp-2.3 and jsf-2.2 with the cdi-1.2 feature. However, you cannot use Java EE 6 features such as jsp-2.2 and jsf-2.0 with the cdi-1.2 feature.
  • You can choose between the CDI 1.0 and CDI 1.2 feature implementations for each server instance, but you must consider the behavior changes. If the behavior is only contained in the CDI 1.2 feature, then you must use the CDI 1.2 feature. If an existing application might be adversely affected by behavior changes in the CDI 1.2 feature, then use the CDI 1.0 feature to preserve the existing behavior for that application.
  • It is not possible to use both the CDI 1.0 and CDI 1.2 features in the same Liberty server. If both features are configured, it produces an error. Read the CDI 1.2 behavior changes topic to learn about changes from CDI 1.0 to CDI 1.2.

Results

The CDI 1.2 feature is enabled and loads in the Liberty server at run time.

Icon that indicates the type of topic Task topic



Timestamp icon Last updated: Monday, 5 December 2016
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-libcore-mp&topic=twlp_cdi_config
File name: twlp_cdi_config.html