Book Image

Drools Developer's Cookbook

By : Lucas Amador
Book Image

Drools Developer's Cookbook

By: Lucas Amador

Overview of this book

<p>JBoss Drools is an open source business rules engine that provides agility and flexibility to your business logic. Drools 5 has evolved to provide a unified and integrated platform for business rules, business processes, event processing and automated planning. With this book in hand you will be able to use any of these modules and their specific features quickly and with ease.<br /><br />Drools Developer Cookbook will help you to apply the latest community features to your projects. You will learn about all the Drools modules - Guvnor, Fusion, Expert, and Planner - along with jBPM5 and integration capabilities. The straightforward recipes will help you to implement even more rules in your projects and take you to a new level with the Drools platform.<br /><br />This book teaches you how to create a more robust business rules implementation, starting with tips on how to write business rules manually, or by using the newest Guvnor rule editors. You will learn how your rules can be integrated with another framework to create a full solution and discover how to use complex features such as event processing. The recipes cover all of the Drools modules and will help you to solve problems with planning, remote execution, and much more.</p>
Table of Contents (16 chapters)
Drools Developer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Setting up Drools using Spring Framework


In this recipe, you will see how to configure the Drools business rules engine using the Spring framework, using the integration module specially created to configure the Drools beans with XML.

How to do it...

Carry out the following steps in order to configure a Drools project using the Spring Framework integration:

  1. Add the following dependency in your Maven project by adding this XML code snippet in the pom.xml file:

    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-spring</artifactId>
      <version>5.2.0.Final</version>
    </dependency>
  2. Once the drools-spring module and the Spring Framework dependencies are added into your project, it's time to write the rules that are going to be included in the knowledge base. This recipe uses the same rule that was used in Chapter 1, shown as follows:

    package drools.cookbook.chapter07
    
    import drools.cookbook.chapter07.model.Server
    import drools.cookbook.chapter07...