Details
-
Bug
-
Resolution: Unresolved
-
Major
-
5.1.1.FINAL
-
Low
Description
KnowledgeBaseOptionsConfiguration:
- <p>
- This class will automatically load default values from a number of places, accumulating properties from each location.
- This list of locations, in given priority is:
- System properties, home directory, working directory, META-INF/ of optionally provided classLoader
- META-INF/ of Thread.currentThread().getContextClassLoader() and META-INF/ of ClassLoader.getSystemClassLoader()
- </p>
Since this properties are only read when "RuleBaseConfiguration" ( KnowledgeBaseOptionsConfiguration implementor ) is constructed, this does not apply/work in case KnowledgeBase is defined via Spring without a <drools:configuration> due to the current sequence of events in "KnowledgeBaseDefinitionParser":
Element kbaseConf = DomUtils.getChildElementByTagName(element, "configuration");
if ( kbaseConf != null )
To fix it, RuleBaseConfiguration ( which implements KnowledgeBaseOptionsConfiguration ) should be created even though "<drools:configuration>" was not provided ( kbaseConf == null ):
Element kbaseConf = DomUtils.getChildElementByTagName(element, "configuration");
BeanDefinitionBuilder rbaseConfBuilder = BeanDefinitionBuilder.rootBeanDefinition( RuleBaseConfiguration.class );
if ( kbaseConf != null )
factory.addPropertyValue( "conf", rbaseConfBuilder.getBeanDefinition() );
Thank you,
/Anatoly