Spring boot + drools rule engine integration details

objective

Most of the official drools examples are based on pure Java projects or Maven projects, while few are based on spring boot projects.

This article describes how to add drools rule engine to spring boot project.

POM dependency

POM files are as follows:

It should be noted that the exec Maven plugin is used, otherwise it cannot be started

The version of the referenced drools package can be adjusted by itself.

Resources

Add two directories under Src / main / resources:

Meta inf and rules

Add kmodule. Under meta inf XML, as follows:

Add a simple hello world rule to the rules directory

Domain layer

The domain layer defines a model to be used in drools:

Service layer

The service layer is responsible for the actual operation rules:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>