As mentioned in the comment by @JavaSheriff, there seems to be no escaping the no-escaping of commas. So I did a hacky little workaround, by taking advantage of Spring's @PostConstruct
annotation, like so:
// the field into which I want to inject values
@Value("${my.application.property}")
private List<String> props;
// an extra field to hold the comma-containing value
@Value("${other.prop}")
private List<String> otherProps;
@PostContruct
private void fixArgs() {
// re-constitute values with commas
String collectedArgs = String.join(",", otherProps);
props.add(collectedArgs);
}
The @PostConstruct
annotation causes the method to be run after the bean has been instantiated and the values injected.