YAML + PropertyPlaceholderConfigurer needs to process non-String values as well [SPR-14737] #19303
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Dennis Mellert opened SPR-14737 and commented
When loading a Yaml resource (using
YamlPropertiesFactoryBean
) and passing it to aPropertyPlaceholderConfigurer
(using<property name="properties" ref="yamlProperties" />
) only String in the Yaml are replaced correctly.The Problem seems to be that
org.springframework.beans.factory.config.PropertyResourceConfigurer.convertProperties(Properties)
only handles Strings (String propertyValue = props.getProperty(propertyName);
). Since the propertyValue is not a String in this case (as parsed fromYamlPropertiesFactoryBean
, the method call returns null.Workaround: Overriding
convertProperties
and dealing with propertyValues asObject
:(Object propertyValue = props.get(propertyName);
Affects: 4.3.3
Issue Links:
Referenced from: commits 74c6188, 3346c59
The text was updated successfully, but these errors were encountered: