Skip to content

YAML + PropertyPlaceholderConfigurer needs to process non-String values as well [SPR-14737] #19303

@spring-projects-issues

Description

@spring-projects-issues

Dennis Mellert opened SPR-14737 and commented

When loading a Yaml resource (using YamlPropertiesFactoryBean) and passing it to a PropertyPlaceholderConfigurer (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 from YamlPropertiesFactoryBean, the method call returns null.

Workaround: Overriding convertProperties and dealing with propertyValues as Object: (Object propertyValue = props.get(propertyName);


Affects: 4.3.3

Issue Links:

Referenced from: commits 74c6188, 3346c59

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions