Restore lenient fallback in case of several non-public constructors

See gh-27437
This commit is contained in:
Juergen Hoeller 2021-09-27 16:52:11 +02:00
parent 93f8706dd3
commit 9ff0d717f2
1 changed files with 7 additions and 8 deletions

View File

@ -254,14 +254,13 @@ public abstract class BeanUtils {
return (Constructor<T>) ctors[0];
}
}
else {
// Several public constructors -> let's take the default constructor
try {
return clazz.getDeclaredConstructor();
}
catch (NoSuchMethodException ex) {
// Giving up...
}
// Several constructors -> let's try to take the default constructor
try {
return clazz.getDeclaredConstructor();
}
catch (NoSuchMethodException ex) {
// Giving up...
}
// No unique constructor at all