CDI integration

One of the first integration frameworks we discussed in this book was the Contexts and Dependency Injection (CDI) standard. It lets us define how we should bind beans together depending on @Inject annotations, to avoid having to write code to init and bind all our beans together. If we are already using CDI in our application, we have already seen we can use injected Kie Sessions, Kie Containers, and Kie Bases in previous chapter. There is no other required change in our application, other than a CDI implementation dependency.

In our chapter-11/chapter-11-ci example, we use Weld (http://weld.cdi-spec.org/) as an implementation by adding this dependency into our POM file:

<dependency><groupId>org.jboss.weld.se</groupId> <artifactId>weld-se-core</artifactId> ...

Get Mastering JBoss Drools 6 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.