From 7635db2a6f82a5699f3b9c04872cdce1d3fecd6d Mon Sep 17 00:00:00 2001 From: Marijn van der Zee Date: Thu, 29 Dec 2011 15:46:43 +0100 Subject: [PATCH] Add note on precedence rules for `PropertyFileVariableSource` --- doc/reference/src/objects.xml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/reference/src/objects.xml b/doc/reference/src/objects.xml index 0010affc..0ff2487f 100644 --- a/doc/reference/src/objects.xml +++ b/doc/reference/src/objects.xml @@ -5091,8 +5091,9 @@ joan_age=35 ${joan_age} variables in your object definitions if you configure the following variable source: - <object type="Spring.Objects.Factory.Config.PropertyFileVariableSource, Spring.Core"> - <property name="Location" value="~\application.properties" /> + <object type="Spring.Objects.Factory.Config.PropertyFileVariableSource, Spring.Core"> + <property name="Location" value="~\application.properties" /> <!-- specify a single ... --> + <property name="Locations" value="~\file1.properties,~\file2.properties" /> <!-- or multiple locations --> <property name="IgnoreMissingResources" value="true"/> </object> @@ -5103,12 +5104,22 @@ joan_age=35 the next variable source(s) of the VariablePlaceholderConfigurer. + + Within PropertyFileVariableSources, + precedence rules differ from the configuration of + VariableSources in the + VariablePlaceholderConfigurer. When the same + property occurs more than once in a property file, the value of the + last entry will be used. Same goes for + specifying the same variable in more than one location in a single + PropertyFileVariableSource: the entry from the + last file will be used. <literal>ConfigurableVariableSource</literal> - A ConfigurableVariableSource allows you + A ConfigurableVariableSource allows you to define variables in-line in a variable source definition. To configure the variables ${midge_name} and ${midge_age}, you can use the following