Files
spring-boot/documentation/spring-boot-docs
Phillip Webb 55eba139ec Support binding of default properties when an empty property is defined
Update the `Binder` so that empty properties are treated as an indicator
that default value binding should be attempted. This update allow bound
objects to differentiate between a completely missing property vs one
that is present but doesn't have any values.

For example, given the following value object:

	@ConfigurationProperties("my")
	public record My(Name name, int age) {

		public record Name(String first, String last) {
		}

	}

The following binding scenarios are supported:

1) Full binding

	my.name.first=Spring
	my.name.last=Boot
	my.age=4

Binds to `new My(new Name("Spring", "Boot"), 4)`
(works the same as Spring Boot 4.0)

2) Missing Properties

	my.age=4

Binds to `new My(null, 4)`
(works the same as Spring Boot 4.0)

3) Default Properties

	my.name=
	my.age=4

Binds to `new My(new Name(null, null), 4)`
(previously would throw a converter exception)

Closes gh-48920
2026-03-17 11:37:51 -07:00
..