Update `DefaultBindConstructorProvider` so that deduced constructors
are not used if there is an existing value.
Prior to this commit, constructor detection logic was not compatible
with earlier versions of Spring Boot. With Spring Boot 3.0.1, given
a class of the following form:
@ConfigurationProperties(prefix = "example")
public class ExampleProperties {
@NestedConfigurationProperty
private final NestedProperty nested = new NestedProperty(
"Default", "default");
public NestedProperty getNested() {
return nested;
}
}
If `NestedProperty` has a single constructor with arguments, constructor
binding would be used. In Spring Boot 2.x, setter injection would have
been used.
The updated code now only uses constructor injection if an explicit
`@ConstructorBinding` annotation is present, or if there is no existing
value.
Fixes gh-33409
See gh-33710