I want to read a list of hosts from a yaml file (application.yml), the file looks like this:
cors:
hosts:
allow:
- http://foo1/
I have been able to read list from properties like below way-
Properties-
cors.hosts.allow[0]=host-0
cors.hosts.allow[1]=host-1
Read property-
@ConfigurationProperties("cors.hosts")
public class ReadProperties {
private List allow;
public List getAllow() {
return allow;
}
public void setAllow(List allow) {
this.allow = allow;
}
}