Keith Barlow created CONFIGURATION-834:
------------------------------------------
Summary: ConfirgurationPropertySource doesn't supply resolved
values.
Key: CONFIGURATION-834
URL: https://issues.apache.org/jira/browse/CONFIGURATION-834
Project: Commons Configuration
Issue Type: Bug
Components: Interpolation, Type conversion
Affects Versions: 2.8.0
Reporter: Keith Barlow
Per
[https://commons.apache.org/proper/commons-configuration/userguide/howto_utilities.html#Use_Configuration_in_Spring,]
we should be able to supply a Configuration to Spring using a
ConfigurationPropertySource to tell spring to obtain property values from
Commons Configuration2, however it seems that the ConfigurationPropertySource
uses getProperty() instead of getString() to supply values to Spring. This
means that the value supplied to string is the literal element from the
configuration file and not the value resolved by Apache Commons Configuration2.
This ultimately leads to Spring trying to parse a syntax it doesn't understand.
When defining values that are resolved from environment properties such as:
{code:java}
property.custom=${env:CUSTOM_PROPERTY_VALUE}{code}
Spring will receive the literal value of '${env:CUSTOM_PROPERTY_VALUE}' and
ultimately treat this as a default value for a property named 'env' instead of
an environment variable reference.
I was able to resolve this by updating ConfigurationPropertSource to use
`source.getString(name)` instead, then Spring will receive the value Commons
Configuration2 has resolved from the environment value and convert it
accordingly on it's own.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)