To keep things simple, do the following:
- Download the cdi-enabler jar from the following mavne repo: https://maven.java.net/content/groups/public/com/oracle/cdi-enabler/cdi-enabler-1_0/1/cdi-enabler-1_0-1.jar
- Add it as dependency to your view controller project where you use CDI.
- Open the beans.xml file and add alternatives as shown below:
Now try running the app, I can see CDI works for me. I hope you may also see the same ;)
The thing mentioned here is a work around for class loading issue that may arise when an application using CDI, packaged with its own JSF implementation(Not the one provided by the underlying container). As both the CDI and JSF implementation are not loaded by class loaders of same level, CDI cannot simply work with JSF implementation provided by app. This is the case for an ADF Faces app. Work around is to make use of CDI 'alternatives' feature to plugin pieces that needs to work with the JSF classes loaded in the current application's context.