You need a kmodule.xml file in your resources folder, like this:
resources -> META-INF -> kmodule.xml
Very important to have this structure. In the META-INF folder you also need to have the following directory:
resources -> META-INF -> maven -> pom.properties
Otherwise working with the kmodule.xml file does not work.
Your definition of the kmodule.xml file would be something like this:
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kbase name="mypackage" packages="drools.rules">
<ksession name="mysession" type="stateless"/>
</kbase>
</kmodule>
If you use packages instead of files, the container could be created in this way:
this.kieContainer = this.kieServices.getKieClasspathContainer();
You would then be able to to create a, for example, stateless session in this way:
StatelessKieSession statelessKieSession = kieContainer.newStatelessKieSession("mysession");
If you need the kieBase for whatever reason, you use:
kieBase = statelessKieSession.getKieBase();
kmoduleand specify your directory so all the rules files in that package/directory will be loaded in theksession. Reference: Drools+SpringBoot - Rupesh