]
Mark Proctor updated JBRULES-2696:
----------------------------------
Assignee: Mauricio Salatino (was: Mark Proctor)
Fix Version/s: 5.2.0.CR1
KnowledgeBaseDefinitionParser Should Always Create
KnowledgeBaseOptionsConfiguration
------------------------------------------------------------------------------------
Key: JBRULES-2696
URL:
https://issues.jboss.org/browse/JBRULES-2696
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: All
Affects Versions: 5.1.1.FINAL
Environment: N/A
Reporter: Anatoly Polinsky
Assignee: Mauricio Salatino
Labels: drools-spring, drools_configuration, spring
Fix For: 5.2.0.CR1
Original Estimate: 1 hour
Remaining Estimate: 1 hour
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 ) {
BeanDefinitionBuilder rbaseConfBuilder =
BeanDefinitionBuilder.rootBeanDefinition( RuleBaseConfiguration.class );
// ... ... ...
factory.addPropertyValue( "conf",
rbaseConfBuilder.getBeanDefinition() );
}
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
--
This message is automatically generated by JIRA.
For more information on JIRA, see: