0

I am new to Drools and due to some specific generalization requirement, I have to implement JBoss Drools with Spring MVC project.I am totally unaware of how to get ahead with it. I would appreciate any tutorials as well as documentation to know about the integration and getting started process. Thanks

4

1 回答 1

1

从我自己的经验来看,drools-spring 库并没有提供太多的好处,并且存在诸如依赖特定版本的 Spring 等问题。

事实上,在 Spring 应用程序中启动和运行 Drools 涉及的集成很少。我的方法是创建一个 Spring bean 来包装 Drools 知识库。

@Component(value="knowledgeService")
public class MyKnowledgeService {
    private KnowledgeBase knowledgeBase;
    private StatefulKnowledgeSession knowledgeSession;
    ...

构造函数可以初始化知识库和会话(如果您使用的是有状态会话)。这样,您就拥有了一个由 Spring 管理的知识库实例。除此之外,您只需在服务上添加一些方法即可启用交互。这些可能只是委托给 Drools 操作。即插入(对象)和fireAllRules()。

于 2012-10-18T11:28:03.937 回答