in spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultBindConstructorProvider.java [34:59]
public Constructor<?> getBindConstructor(Bindable<?> bindable, boolean isNestedConstructorBinding) {
Class<?> type = bindable.getType().resolve();
if (bindable.getValue() != null || type == null) {
return null;
}
if (KotlinDetector.isKotlinPresent() && KotlinDetector.isKotlinType(type)) {
return getDeducedKotlinConstructor(type);
}
Constructor<?>[] constructors = type.getDeclaredConstructors();
if (constructors.length == 1 && constructors[0].getParameterCount() > 0) {
return constructors[0];
}
Constructor<?> constructor = null;
for (Constructor<?> candidate : constructors) {
if (!Modifier.isPrivate(candidate.getModifiers())) {
if (constructor != null) {
return null;
}
constructor = candidate;
}
}
if (constructor != null && constructor.getParameterCount() > 0) {
return constructor;
}
return null;
}