【问题标题】:how can I use spring boot Service class in .drl files in Optaplanner Planning projects?如何在 Optaplanner 规划项目的 .drl 文件中使用 spring boot 服务类?
【发布时间】:2021-03-11 11:13:22
【问题描述】:

不在drools 项目,只是在Optaplanner 规划项目。 带有流口水引擎的 Optaplanner !!! use spring boot service classs in drools project

这里有更多关于这个问题的信息 code structure

这里服务在drl文件中的功能

rule "RuleLimosis"
when
    ViewPatient($RevId:Id,$PatientID:PatientID, PatientID != null)
then
    boolean limosisFlag = viewPatientService.getChecklistLimosis($RevId);
    System.out.println("empty stomach status: " + limosisFlag);

结束

运行时信息在规划解决方案类中使用@ProblemFactProperty

1 System.out.println("在java文件中viewPatientService是:" + viewPatientService);

2 System.out.println("在drl中一个文件viewPatientService是:" + viewPatientService);

代码 1 的值正确 代码2为空

【问题讨论】:

    标签: spring spring-boot optaplanner


    【解决方案1】:

    您可以将服务包装在一个类中,并在规划解决方案中创建该包装类的@ProblemFactProperty 字段。

    但您的限制不应该是调用远程服务,因为这会削弱您的分数计算速度。

    【讨论】:

    • 我编辑了我的问题,我的代码结构和我的部分 drl 文件已发布。这个问题困扰了我一整天。大声笑
    猜你喜欢
    • 1970-01-01
    • 2015-12-29
    • 1970-01-01
    • 2018-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-11
    • 1970-01-01
    相关资源
    最近更新 更多