8.2. Use CDI

8.2.1. First Steps

8.2.1.1. Enable CDI

Task Summary

Contexts and Dependency Injection (CDI) is one of the core technologies in the JBoss Enterprise Application Platform, and is enabled by default. If for some reason it is disabled and you need to enable it, follow this procedure.

Procedure 8.1. Task:

  1. Check to see if the CDI subsystem details are commented out of the configuration file.

    A subsystem can be disabled by commenting out the relevant section of the domain.xml or standalone.xml configuration files, or by removing the relevant section altogether.
    To find the CDI subsystem in EAP_HOME/domain/configuration/domain.xml or EAP_HOME/standalone/configuration/standalone.xml, search them for the string <extension module="org.jboss.as.weld"/>. If it exists, it is located inside the <extensions> section.
  2. Before editing any files, stop the JBoss Enterprise Application Platform.

    The JBoss Enterprise Application Platform modifies the configuration files during the time it is running, so you must stop the server before you edit the configuration files directly.
  3. Edit the configuration file to restore the CDI subsystem.

    If the CDI subsystem was commented out, remove the comments.
    If it was removed entirely, restore it by adding this line to the file in a new line directly above the </extensions> tag:
    <extension module="org.jboss.as.weld"/>
  4. Restart the JBoss Enterprise Application Platform.

    Start the JBoss Enterprise Application Platform with your updated configuration.
Result:

The JBoss Enterprise Application Platform starts with the CDI subsystem enabled.