Nucleus can configure a component from properties that are set in multiple configuration directories. If configuration files in multiple directories set the same property, Nucleus can resolve this in two ways:
Override Property Settings from previously-read configuration files.
Combine Multi-Value Property Settings from multiple configuration files.
Override Property Settings
You can override the settings in any properties file from another properties file that has higher precedence. For example, any settings in a module’s base configuration can be overridden by a properties file of the same name in the application’s localconfig
directory.
Combine Multi-Value Property Settings
You can concatenate settings from multiple files for a given multi-value property (such as an array or list) by using the +=
operator, as follows:
property-name
+=
property-setting[
,
property-setting]...
Note: No white space should precede or follow the +=
operator.
For example, suppose a component named /Stuff
has an array property named colors
that is initially set like this:
colors=red,blue,green
You can use the +=
operator in another Stuff.properties
file that has higher precedence to add values to this property. For example:
colors+=yellow,orange
Combined with the initial setting of the /Stuff.colors
property, this results in the following setting:
colors=red,blue,green,yellow,orange
There is also a -=
operator that you can use to remove values. For example:
colors-=blue
Combined with the initial setting of the /Stuff.colors
property, this results in the following setting:
colors=red,green
Finally, there is a ^+=
operator that you can use to add values by linking to the values of another component’s property. For example:
colors^+=/OtherComponent.beautifulColors
So, for example, if the value of /OtherComponent.beautifulColors
is purple,gold
, combining this with the initial setting of /Stuff.colors
results in:
colors=red,blue,green,purple,gold
Note: Prior to version 11.2 of the Oracle Commerce Platform, values set using one of these operators would overwrite values that had been set in properties files with lower precedence, if those values were set by linking to other components using the ^=
operator. In versions later than 11.2, this behavior has been corrected so that the values are combined as expected. See Linking Property Values for information about the ^=
operator.