Posted by mriem
on December 10, 2013 at 3:46 AM PST
Occasionally, users have the need to override the version of JSF included in the application server by bundling a different version of JSF with their application. If you are trying to use CDI in such a scenario, you might have noticed it does not work. Is there a way out?
Yes, there is, by including a small JAR and some configuration in your web application you can make this scenario work.
Add the following Maven dependency to your web application.
Then add the following beans.xml to your WEB-INF directory and you are set to go!
<?xml version="1.0" encoding="UTF-8"?>
Note this particular version of the JAR requires you to use this on a JavaEE6 container that bundles a CDI 1.0 implementation, like Glassfish 220.127.116.11 or Weblogic 12.1.2.
And that is it.