-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Labels
type: regressionA regression from a previous releaseA regression from a previous release
Milestone
Description
Scenario:
A ConfigurationProperties
class contains a Map<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
:
package com.example.demo
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.ConfigurationPropertiesScan
import org.springframework.boot.context.properties.ConstructorBinding
import org.springframework.boot.runApplication
import javax.annotation.PostConstruct
@ConfigurationProperties("test")
@ConstructorBinding
class Properties(
val map: Map<String, String>
)
@SpringBootApplication
@ConfigurationPropertiesScan
class DemoApplication {
@Autowired
private lateinit var properties: Properties
@PostConstruct
fun postInit() {
println(properties.map.toString())
}
}
fun main(args: Array<String>) {
runApplication<DemoApplication>(*args)
}
application.yml
:
test:
map:
foo: foo
baz: baz
bar: bar
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
maxtacco, MochiJump and hikumar-copart
Metadata
Metadata
Assignees
Labels
type: regressionA regression from a previous releaseA regression from a previous release