So I have been trying to a list
property from my YAML
to a class that I made and somehow the list binding can only recognize comma-separated values from the YAML.
Given this class
@Getter
@Configuration
@ConfigurationProperties
@PropertySource("classpath:test.yml")
public class SomeProperty {
final List<String> someList = new ArrayList<>();
}
And this yaml file
someList:
- a
- b
If I autowire
the SomeProperty
somewhere and print the someList
, it will return an empty list, but if I change the yaml file to this
someList: a,b
Then the binding works and returns an array list containing the values. What is the problem with the binding?