drools配置

 

Pom

<dependency>
   <groupId>org.kiegroupId>
   <artifactId>kie-apiartifactId>
   <version>${drools-version}version>
dependency>
<dependency>
   <groupId>org.kiegroupId>
   <artifactId>kie-internalartifactId>
   <version>${drools-version}version>
dependency>
<dependency>
   <groupId>org.droolsgroupId>
   <artifactId>drools-coreartifactId>
   <version>${drools-version}version>
dependency>
<dependency>
   <groupId>org.droolsgroupId>
   <artifactId>drools-compilerartifactId>
   <version>${drools-version}version>
dependency>
<dependency>
   <groupId>org.kiegroupId>
   <artifactId>kie-springartifactId>
   <version>${drools-version}version>
dependency>
<dependency>
   <groupId>org.mvelgroupId>
   <artifactId>mvel2artifactId>
   <version>2.3.1.Finalversion>
dependency>
<dependency>
   <groupId>org.eclipse.jdtgroupId>
   <artifactId>coreartifactId>
   <version>3.1.1version>
dependency>
<dependency>
   <groupId>org.springframework.roogroupId>
   <artifactId>org.springframework.roo.classpath.antlrjavaparserartifactId>
   <version>1.3.2.RELEASEversion>
dependency> 

 

applicationContext 

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:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
      xmlns:kie="http://drools.org/schema/kie-spring"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
       http://drools.org/schema/kie-spring http://drools.org/schema/kie-spring.xsd
       "
       default-lazy-init="false"
       >

 

 

 


<kie:kmodule id="kmodule">  
   <kie:kbase name="kbase" packages="rules">
      <kie:ksession name="ksession" scope="prototype"/> 
   kie:kbase>
kie:kmodule>
<bean id="kiePostProcessor" class="org.kie.spring.annotations.KModuleAnnotationPostProcessor " />
 
 
使用
//    @Autowired
//    @KSession("ksession")//注: 这里的值与配置文件中的值是一样的
//    private KieSession  ksession;
//
    @Autowired
    private KieBase kbase;
 
详情见百度云
 
  

 

 

你可能感兴趣的:(其他,drools)