A global properties file can set the same property in multiple components. The property settings in a GLOBAL.properties
file apply to all components in the file’s configuration directory and subdirectories.
For example, /localconfig/services/GLOBAL.properties
might have the following setting:
currentWeather=miserably hot
This setting is applied to any component in /services
and its subdirectories that contains the currentWeather
property.
Precedence of Global and Component Settings
A component’s own property settings have precedence over global property settings. For example, if the component /services/Sunny
sets the currentWeather
property, that value overrides the global setting; if the component omits the currentWeather
property, it uses the global setting. A component can also be set by multiple global properties files, where the global properties file that is most proximate to the component has precedence over other global properties files.
In the following example, the component /services/Sunny
is configured by two global properties files and its own properties file, listed in ascending order of precedence:
localconfig/GLOBAL.properties
localconfig/services/GLOBAL.properties
localconfig/services/Sunny.properties
Combining Global and Component Settings
Property files can append values to those set by a global properties file. For example, a global properties file might declare the property affectedCities
:
affectedCities=Detroit,Boston,Los Angeles
A contained component can append a single value to the same property as follows:
affectedCities+=Chicago
This yields the following composite of settings for the component:
affectedCities=Detroit,Boston,Los Angeles,Chicago