Pages

Monday, November 11, 2013

Spring and Drools

Let us assume that we have dozens of rules that we have to implement, divide into some classes, subclasses, abstractions and of course unit test. This can be difficult and time consuming to both write and support. There are many ways of dealing with this problem and following example leverages one of them - JBoss Drools. Drools is a library specifically created for such purposes like implementing rules. It contains a rule engine that can process rules written using the Drools language (you can also provide rules in Excel spreadsheets! - perfect for Business side to support and management). Here, we will take a look at the way one can integrate JBoss Drools with Spring. (Reference: http://java.dzone.com/articles/drools-integration-spring-vs)

POJO Class:
Main Class:
Service Class:
Util Class:
applicationContext.xml
drools-context.xml
log4j.xml
Rule file(account-rules.drl)
pom.xml Project Structure:
And here goes the output.

Enjoy Drooling!

No comments:

Post a Comment