How to read application.yml in Spring XML configurations?

Viewed 23

In my project using XML based configurations and trying to read application.yml file

application.yml file

vtp:
  config:
      priority: 
        2:
          country: 'US'
          countryFriend: ['UK','AG']
        3:
          country: 'IN'
          countryFriend: ['UK','AG']
        4:
          country: 'PO'
          countryFriend: ['NL']
        5:
          country: 'KN'
          countryFriend: ['DN']

I can able to read it using Spring Boot creating POJO class to map the properties like below

@Configuration
@ConfigurationProperties(prefix = "vtp.config")
@PropertySource(value = "classpath:application.yml")
public class MeraPriorityConfig {
    private Map<String, Config> priority;

    public Map<String, Config> getPriority() {
        return priority;
    }

    public void setPriority(Map<String, Config> priority) {
        this.priority = priority;
    }
}

How can I do the same from xml based configurations?

0 Answers
Related