Simplifying the configuration file
- Last Updated: May 13, 2026
- 2 minute read
- Semaphore
- Documentation
Because we are using the Spring Framework Insertion of Dependencies configuration method, the range of configuration tricks that they make available are also available to us.
A handful of the most useful are defined below.
Import
If there are chunks of configuration that you will not want to edit much - or maybe you want to share them between different configurations, you can extract out some of the beans into separate files and reference them in the main configuration file using an <include> element. Instances of this can be seen in the supplied configuration file, e.g.:
<import resource="file:${config.directory}/includes/ModelInterface.xml" />
This means import the file ModelInterface that is located in the includes sub-directory of the configuration directory. The “file:” prefix means that the file name is given relative to the location of the application (usually the parent directory of the conf directory). If this were missing, then the location is relative to the location of the file in which the import is defined.
Property inheritance
If there are a number of configuration items that are very similar, but differ only in one or two properties, then it is possible to define a “parent” object. If marked as “abstract” then this object will not itself be created, but its properties used to populate any bean that selects this parent.
For instance, in the default configuration, in the includes/RulebaseStructure.xml we have defined
<bean id="defaultRulebaseWriter" abstract="true" >
<property name="temporaryDirectory" value="temp/${model.name}" />
<property name="attributeResolvers">
<list>
<ref bean="rulebaseInfluenceHandler" />
<ref bean="stemmingHandler" />
<ref bean="caseSensitivityHandler" />
</list>
</property>
<property name="ignoredAttributes" ref="ignoredAttributes" />
<property name="promotedAttributes" ref="promotedAttributes" />
</bean>
This defines the basic properties for a kid writer - however, because it is marked as “abstract” it will not itself be created.
In the main configuration file Semaphore-Publisher.xml, we see the Kid Writer itself defined by
<bean id="namedEntityRulebaseWriter" class="com.smartlogic.publisher.kid.KidWriter" parent="defaultRulebaseWriter" >
<property name="templateDirectory" value="templates" />
<property name="templateFileName" value="NamedEntity.kid" />
<property name="rulebaseClass" value="NamedEntity" />
</bean>
By defining the “parent” object on this Kid Writer we are setting all the properties defined on the parent onto the child object. So the namedEntityRulebaseWriter will have its attributeResolvers defined without needing to explicitly define them. This will be particularly useful when there are many Kid Writers that only differ in the template that they are using to render the rulebases.