【发布时间】:2017-08-25 07:22:05
【问题描述】:
我已经成功地使用 6.3.0.Final 版本、CDI 1.2 版本和 Weld 2.30.Final 版本运行带有 CDI 的 Drools。使用下面的代码示例。
https://github.com/Salaboy/drools-workshop/tree/master/my-first-drools-project
public class App {
@Inject
@KSession
private KieSession kSession;
public void bootstrapDrools() {
// The KieSession was injected so we can use it now
kSession.insert("Hi There!");
int rulesFired = kSession.fireAllRules();
System.out.println(">>> Rules Fired: "+rulesFired);
}
public static void main(String[] args) {
//Boostrap the CDI container, in this case WELD
Weld w = new Weld();
WeldContainer wc = w.initialize();
App app = wc.select(App.class).get();
app.bootstrapDrools();
w.shutdown();
}
}
现在我正在尝试使用 drools 7.2.0 final 做同样的事情。
但我无法让它工作。有什么想法吗?
【问题讨论】: