Closed
Description
Consider the following configuration including a list:
@Component
@ConfigurationProperties(prefix = "listConfiguration")
public class ListConfiguration {
private final List<String> someList = new ArrayList<>();
public List<String> getSomeList() {
return someList;
}
}
When the list is defined with 1 item per line, it all works as expected, getSomeList()
returns [1, 2, 3]
listConfiguration:
someList:
- 1
- 2
- 3
However, when the list is defined on a single line, getSomeList()
returns []
.
listConfiguration:
someList: 1, 2, 3
This can be fixed by giving up immutability and adding a setSomeList()
setter, but I would say that the current behavior is error prone. You'd normally expect the two list definitions to be equivalent.
Maybe this is just something to keep in mind when implementing #8762.
Tested on 1.5.6-RELEASE.