I'm big into CDI, but I'm not fond of application servers at all. So I'm bound to find out how to configure how to activate the CDI magic on a simple servlet container like Tomcat. That shouldn't be too difficult. Mind you, it's easy to run Weld (which happens to be the reference implementation of CDI) without a servlet container. However, in the past getting Weld on Tomcat proved to be a tad difficult, due to mediocre documentation. Luckily, that has changed. Jo Desmet (at least I suppose he's the man behind the Musings in Java blog) has published a nice walk-through to get CDI and JSF on Tomcat 8 up and running. I followed his step-by-step tutorial and managed to activate CDI on my Tomcat 8 in a couple of minutes. Highly recommended! However, no tutorial is so good it can't be improved, so let me add one or two notes on it: Cutting a long story short, you don't need a full-blown application server just to use CDI!

Dig deeper

Zakee-Web: a project template supporting CDI, JSF and JAX-RS on a Tomcat My fork of Zakee-Web