tdonohue commented on PR #309:
URL:
https://github.com/apache/commons-configuration/pull/309#issuecomment-2122895973
I've run into an odd bug when using Commons Configuration v2 + Spring Boot
which I *believe* is caused by a change in this small PR. During a routine
upgrade from Commons Configuration v2.9.0 to v2.10.1, we discovered that our
multivalued configurations (i.e. an array or list of values) were only loading
the **first value** into Spring. In other words, it seems to no longer be
possible to load multivalued configurations into Spring Beans via something
like this:
```
@Value("${some.multivalued.prop}")
String[] myMultivaluedVariable;
```
I could be wrong, but I *believe* it may be caused by the change from
`getProperty()` to `getString()` in this PR, because `getString()` is
[documented to only return the **first value** in a list of
values](https://commons.apache.org/proper/commons-configuration/userguide/howto_basicfeatures.html#List_handling).
> Of interest is also the last line of the example fragment. Here the
`getString()` method is called for a property that has multiple values. This
call will return the first value of the list.
I don't know of the proper solution to this issue, but I can confirm that
v2.9.0 works properly for multivalued configurations, but both v2.10.0 and
v2.10.1 do not (in both those versions we are seeing only the first value
loaded into Spring for multivalued configurations).
Finally, my apologies for adding this comment on a closed PR (as I realize
that's not the best practice in OSS). I've requested a login to your
[JIRA](https://issues.apache.org/jira/projects/CONFIGURATION/issues) to report
this as a possible bug, but I'm waiting for approval. So, I'll move these
notes over to JIRA once given permissions to do so.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]