Skip to content

Regression with property binding to List<String> #13303

@marcelstoer

Description

@marcelstoer

With 1.5.x I used to have a property binding like this; a comma-separated String to List<String>.

@ConfigurationProperties(prefix = "foo.bar")
public class MyAppProperties {
    private final Kafka kafka = new Kafka();

    public Kafka getKafka() {
        return this.kafka;
    }

    public static class Kafka {
        private List<String> topics;
        public void setTopics(List<String> topics) {
            this.topics = topics;
        }
...
foo.bar:
    kafka:
      topics: test,failures

With Boot 2.0.2 this now fails with

Failed to bind properties under 'foo.bar.kafka.topics' to java.util.List<java.lang.String>:

    Reason: Unable to get value for property topics

Replacing List<String> in the setter with String[] fixes this.

public void setTopics(String[] topics) {
  this.topics = Lists.newArrayList(topics);
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions