Spring Boot: read list from yaml using @Value or @ConfigurationProperties
问题 I want to read a list of hosts from a yaml file (application.yml), the file looks like this: cors: hosts: allow: - http://foo1/ - http://foo2/ - http://foo3/ (Example 1) My class used defines the value like this: @Value("${cors.hosts.allow}") List<String> allowedHosts; But reading fails as Spring complains about this: java.lang.IllegalArgumentException: Could not resolve placeholder 'cors.hosts.allow' in string value "${cors.hosts.allow}" When I change the file like this the property can be