drools的helloword
作者:互联网
<dependency> <groupId>org.drools</groupId> <artifactId>drools-compiler</artifactId> <version>7.10.0.Final</version> </dependency>
hello.drl
package rules.hello rule "test001" when eval(true); then System.out.println("hello word"); end
kmodule.xml
<?xml version="1.0" encoding="UTF-8"?> <kmodule xmlns="http://www.drools.org/xsd/kmodule"> <kbase name="" packages="rules.hello"> <ksession name="testhelloworld"/> </kbase> </kmodule>
public static void main(String[] args) { KieServices kieServices = KieServices.Factory.get(); KieContainer kieClasspathContainer = kieServices.getKieClasspathContainer(); KieSession testhelloworld = kieClasspathContainer.newKieSession("testhelloworld"); int i = testhelloworld.fireAllRules(); System.out.println(i); kieClasspathContainer.dispose(); }
标签:drools,helloword,System,kieClasspathContainer,testhelloworld,hello,out 来源: https://www.cnblogs.com/q1359720840/p/16204111.html