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

Clarify javadoc of YamlPropertiesFactoryBean regarding comma-separated list property value [SPR-13527] #18104

Closed
spring-projects-issues opened this issue Oct 2, 2015 · 2 comments
Assignees
Labels
in: core type: task
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Oct 2, 2015

Florian Morgan opened SPR-13527 and commented

YamlPropertiesFactoryBean doesn't generate the comma-separated list property value.

The JavaDoc states that :

"Lists are represented as comma-separated values (useful for simple String values) and also as property keys with [] dereferencers..."
The example even says that the following yaml:

servers:
- dev.bar.com
- foo.bar.com

would become the following java properties:

servers=dev.bar.com,foo.bar.com
servers[0]=dev.bar.com
servers[1]=foo.bar.com

I've provided a simple JUnit test to illustrate the issue. It has 3 tests, two with the [] dereferencers, and one with the comma-separated values.
The first and second tests pass, but the last one fail.

I've reproduced it in 4.2.1.RELEASE and 4.2.2.BUILD-SNAPSHOT.


Affects: 4.2.1

Attachments:

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 2, 2015

Dave Syer commented

I believe the documentation is wrong. The CSV view of arrays was a Spring Boot feature in 0.5.0 and I believe we squashed it in 1.x somewhere (probably before 1.0). The reason it doesn't work very well is that you end up with 2 representations of the same data in one Map (or PropertySource or whatever). Consequently anyone wanting to bind to it has too many choices, and it will break some of the nice stuff you get for free otherwise in Spring binding.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 2, 2015

Stéphane Nicoll commented

Let's fix the javadoc. Thanks.

@spring-projects-issues spring-projects-issues added in: core type: task labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.2.2 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: task
Projects
None yet
Development

No branches or pull requests

2 participants