-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Closed
Description
Binding to @ConfigurationProperties
with a Map
does not preserve the order of keys, even though the order is carefully preserved in YamlPropertySourceLoader
. The culprit is PropertySourcesPropertyValues
which has an unordered map of name-value pairs. Example:
@Component
@EnableConfigurationProperties
@ConfigurationProperties("foo")
public static class Foo {
private Map<String,Bar> bar = new LinkedHashMap<String, Bar>();
public Map<String, Bar> getBar() {
return bar;
}
public void setBar(Map<String, Bar> bar) {
this.bar = bar;
}
public static class Bar {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
}
foo:
bar:
one:
name: uno
two:
name: due
three:
name: trei
four:
name: quattro
five:
name: cinque
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug