Skip to content

Empty yaml objects are not injected as properties #19095

@jntakpe

Description

@jntakpe

Spring Boot version: 2.2.1.RELEASE

Having the following properties

prefix:
  obj:
    foo:
      firstName: John
      lastName: Doe
    bar: {}

And given the following properties class

@ConstructorBinding
@ConfigurationProperties("prefix")
data class ObjProperties(val obj: Map<String, FooBarProperties>)

@ConstructorBinding
data class FooBarProperties(val firstName: String? = "", val lastName: String? = "")

I was expecting that injecting ObjProperties bean will result in having both foo property and bar property in obj map. Unfortunately, bar property is missing from the objmap.

Metadata

Metadata

Assignees

Labels

status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions