Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML configuration binding to list is inconsistent #10172

Closed
bcalmac opened this issue Sep 5, 2017 · 1 comment
Closed

YAML configuration binding to list is inconsistent #10172

bcalmac opened this issue Sep 5, 2017 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@bcalmac
Copy link

bcalmac commented Sep 5, 2017

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 5, 2017
@wilkinsona
Copy link
Member

This has already been addressed in the binder improvements in 2.0

@wilkinsona wilkinsona added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants