Getting ready

First, you need to add the right CDI 2.0 dependency to your project. To make things easier at this point, we are going to use CDI SE, the dependency that allows you to use CDI without a Java EE server:

<dependency>    <groupId>org.jboss.weld.se</groupId>    <artifactId>weld-se-shaded</artifactId>    <version>3.0.0.Final</version></dependency>

Get Java EE 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.