mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 03:33:27 +08:00
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 |
||
---|---|---|
.. | ||
spring-boot | ||
spring-boot-actuator | ||
spring-boot-actuator-autoconfigure | ||
spring-boot-autoconfigure | ||
spring-boot-dependencies | ||
spring-boot-devtools | ||
spring-boot-docs | ||
spring-boot-parent | ||
spring-boot-starters | ||
spring-boot-test | ||
spring-boot-test-autoconfigure | ||
spring-boot-tools |