Getting ready

First, let's add the required dependency needed:

<dependency>    <groupId>javax.enterprise</groupId>    <artifactId>cdi-api</artifactId>    <version>2.0</version>    <scope>provided</scope></dependency> <dependency>    <groupId>javax</groupId>    <artifactId>javaee-web-api</artifactId>    <version>7.0</version>    <scope>provided</scope></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.