When defaulting values in a Spring XML configuration file with the following snippet:
<util:properties id="defaultConfiguration">
<prop key="test.value">${first.value:notFilledIn}</prop>
</util:properties>
<context:property-placeholder properties-ref="defaultConfiguration" order="605" ignore-unresolvable="true"/>
With the following properties being loaded:
first.value=first
second.value=second
The value always comes back as the "default" value, not the first key.
@Value("${test.value}")
private String theValue;
.....
System.out.println("theValue: " + theValue);
Output:
theValue: notFilledIn
If I change the prop value in the XML config to:
<prop key="test.value">${first.value}</prop>
The value comes back as expected:
theValue: first
Why is the default value always being pulled, when the "key" to the first value exists?