Fix binding detection of ConfigurationProperties contributed by @Bean
This commit makes sure that a ConfigurationProperties type contributed by a `@Bean` factory method uses properties binding regardless of the presence of a matching constructor. `@Bean` method makes sure the user is in control and will be responsible of creating the instance. As a result, binding of properties will not happen there and therefore can only happen with regular JavaBean accessors. Closes gh-18184
This commit is contained in:
@@ -51,6 +51,9 @@ class PropertyDescriptorResolver {
|
||||
*/
|
||||
Stream<PropertyDescriptor<?>> resolve(TypeElement type, ExecutableElement factoryMethod) {
|
||||
TypeElementMembers members = new TypeElementMembers(this.environment, type);
|
||||
if (factoryMethod != null) {
|
||||
return resolveJavaBeanProperties(type, factoryMethod, members);
|
||||
}
|
||||
ExecutableElement constructor = resolveConstructor(type);
|
||||
if (constructor != null) {
|
||||
return resolveConstructorProperties(type, factoryMethod, members, constructor);
|
||||
|
||||
Reference in New Issue
Block a user