Enhancements requests
Currently https://github.com/spring-projects/spring-framework/blob/main/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java#L92 provides support for parsing XML & .properties file. But it fails to parse if the properties file is defined as YAML.
Right now PropertiesLoaderUtils already checks for XML file extension & it can similarly check for YAML file extension & replace the current parsing logic with a custom implementation.
I agree that currently this can be achieved by providing a custom implementation of PropertySourceFactory as below without the need of any external library dependency
public class YamlPropertySourceFactory implements PropertySourceFactory {
@Override
public PropertiesPropertySource createPropertySource(String name, EncodedResource resource) {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(resource.getResource());
Properties properties = factory.getObject();
String sourceName = (name != null) ? name : resource.getResource().getFilename();
return new PropertiesPropertySource(sourceName, properties);
}
}
Though considering that YAML format is getting more traction(start.spring.io started supporting YAML format last year), can an out of box support be considered for supporting YAML files?
Enhancements requests
Currently https://github.com/spring-projects/spring-framework/blob/main/spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java#L92 provides support for parsing XML &
.propertiesfile. But it fails to parse if the properties file is defined as YAML.Right now
PropertiesLoaderUtilsalready checks for XML file extension & it can similarly check for YAML file extension & replace the current parsing logic with a custom implementation.I agree that currently this can be achieved by providing a custom implementation of
PropertySourceFactoryas below without the need of any external library dependencyThough considering that YAML format is getting more traction(start.spring.io started supporting YAML format last year), can an out of box support be considered for supporting YAML files?