In this section we'll describe the validation slice of this application (from bottom to top) that includes a definition of validation knowledge base, validation service, and the user interface.
We already have the validation service implementation. We'll now configure it with Spring. The first step is to build the validation knowledge base that will be used by the validation service. It will be managed by Spring like any other bean. The configuration goes into the applicationContext.xml
file.
Fortunately, Drools does integrate with Spring out of the box. It provides its own namespace. The validation knowledge base can be defined like this:
<drools:kbase id="validationKnowledge"> <drools:resources> <drools:resource type="DRL" source="classpath:validation.drl" /> </drools:resources> </drools:kbase>
Code listing 10: Extract from the Spring configuration (the applicationContext.xml file), which is a validation knowledge base configuration...