整合需要jar包 drools-spring-5.2.0.Final.jar在droolsjbpm-integration-distribution-5.2.0.Final\binaries文件夹下。
spring-drools 配置文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:flex="http://www.springframework.org/schema/flex"
xmlns:drools="http://drools.org/schema/drools-spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/flex
http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
http://drools.org/schema/drools-spring
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring-1.0.0.xsd">
<drools:kbase id="kBase">
<drools:resources>
<drools:resource type="DRL" source="classpath:com/iyspace/drools/resource/insert.drl"/>
</drools:resources>
<drools:configuration>
<drools:mbeans enabled="true"/>
<drools:event-processing-mode mode="STREAM"/>
</drools:configuration>
</drools:kbase>
<drools:ksession kbase="kBase" type="stateful" id="statefulKnowledgeSession"/>
<drools:ksession kbase="kBase" type="stateless" id="ksession" name="stateless1"/>
</beans>
本文介绍如何将规则引擎Drools与Spring框架进行集成。通过配置XML文件,实现加载DRL规则文件,并创建状态化与非状态化的会话。

528

被折叠的 条评论
为什么被折叠?



