You can check YamlPropertySourceLoader how it is implemented. Once you implement it method
org.springframework.boot.env.YamlPropertySourceLoader#getFileExtensions
will be called once you add something like this
@ConfigurationProperties(locations="classpath:config.xml")
But watching implementation of YamlPropertySourceLoader it looks like you will have a lot of work to do, with paring etc.
You should check if yaml will be sufficient for you because it gives you possibility to make structured properties:
For example, the following YAML document:
environments:
dev:
url: http://dev.bar.com
name: Developer Setup
prod:
url: http://foo.bar.com
name: My Cool App
Would be transformed into these properties:
environments.dev.url=http://dev.bar.com
environments.dev.name=Developer Setup
environments.prod.url=http://foo.bar.com
environments.prod.name=My Cool App
YAML lists are represented as property keys with [index] dereferencers, for example this YAML:
my:
servers:
- dev.bar.com
- foo.bar.com
Would be transformed into these properties:
my.servers[0]=dev.bar.com
my.servers[1]=foo.bar.com
Even if you have XML docs ready and that is reason you want to load them in configuration it looks much more simple to convert XML to YAML (https://github.com/FasterXML/jackson-dataformat-xml) and than using existing YamlPropertySourceLoader than to write your own PropertySourceLoader.