vaadin/cdi — pull request #20 by Blimster (2013-05-06 18:58:45+00:00)
Title: Support for CDI environments that do not support injection into servlet context listeners

I want to use Vaadin with CDI in a servlet container like Tomcat 7.

To make CDI available in Tomcat, I use the weld-servlet, which not supports injection into listeners. Unfortunately, the vaadin-cdi-integration is using a context listener to deploy the vaadin servlet.

In my commit, the ContextDeployer is only executed if the injection of the BeanManager was successful. In the case you have to specify the Vaadin servlet on the CDIUIProvider in the web.xml.

In the CDIUIProvider, if the BeanManager is not found by the name "java:comp/BeanManager" then it also tries to lookup with the name "java:comp/env/BeanManager" (Tomcat provides resource under "java:comp/env/". You must also specify the BeanManager as a resource in the context.xml and in the web.xml as described at http://docs.jboss.org/weld/reference/1.0.0/en-US/html/environments.html#d0e4998.