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
Order of map property in application yaml is no longer preserved #21470
Comments
Thanks for the report. I'm not sure that we've ever deliberately guaranteed the ordering, but I can see that it's changed in 2.3. I get |
This issue breaks spring cloud zuul routes configuration. From Spring Clould Netflix documentation:
If you were to use a properties file, the legacy path might end up in front of the users path, rendering the users path unreachable. |
Is somewhere documented that order is preserved? |
@dumitrulapteacru-endava No, I don't believe so. As I said above we've never deliberately guaranteed the ordering. I would avoid relying on it unless you have a good reason to do so. |
thank you @wilkinsona |
Scenario:
A
ConfigurationProperties
class contains aMap<String, String>
property.The contents of the map are specified in an
application.yml
file.Expected behavior:
The order of the map entries (as specified in the yaml file) is preserved. This is the case with Spring-Boot 2.2.7.
Actual behavior:
The order of the map entries (as specified in the yaml file) is not preserved. This is the case with Spring-Boot 2.3.0.
Minimal project to reproduce:
DemoApplication.kt
:application.yml
:Spring-Boot 2.2.7 prints:
{foo=foo, baz=baz, bar=bar}
Spring-Boot 2.3.0 prints:
{baz=baz, bar=bar, foo=foo}
Demo Project: demo.zip
The text was updated successfully, but these errors were encountered: