在drools 6中,Spring integration发生了一些变化,因此不再指定资源。
<drools:resources>
<drools:resource type="DRL"
source="classpath:rules/products.drl"/>
</drools:resources>
如何在版本6中指定它们呢?
答案 0 :(得分:0)
请注意,在Drools 6中,要加载的drl文件应放在maven项目的main / resources文件夹下。在运行时说在Tomcat中,drl文件将出现在&lt; yourwebapp&gt; / WEB-INF / classes文件夹下。
示例xml config:
<?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:kie="http://drools.org/schema/kie-spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://drools.org/schema/kie-spring http://drools.org/schema/kie-spring.xsd">
<kie:kmodule id="kmoduleCEP">
<kie:kbase name="kbaseCEP" eventProcessingMode="stream"
equalsBehavior="equality">
<kie:ksession name="ksessionCEP" type="stateful"
clockType="realtime">
<kie:agendaEventListener ref="agendaEventListener" />
<kie:ruleRuntimeEventListener ref="workingMemoryEventListener" />
<kie:batch>
<kie:set-global identifier="callbackService">
<ref bean="callbackService" />
</kie:set-global>
</kie:batch>
</kie:ksession>
</kie:kbase>
</kie:kmodule>
</beans>
而不是drools-弹簧神器使用kie-spring。类似的东西:
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-spring</artifactId>
<version>${org.drools.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${org.drools.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${org.drools.version}</version>
</dependency>