Skip to content

Commit 9ff0d71

Browse files
committed
Restore lenient fallback in case of several non-public constructors
See gh-27437
1 parent 93f8706 commit 9ff0d71

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

spring-beans/src/main/java/org/springframework/beans/BeanUtils.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,13 @@ else if (ctors.length == 0){
254254
return (Constructor<T>) ctors[0];
255255
}
256256
}
257-
else {
258-
// Several public constructors -> let's take the default constructor
259-
try {
260-
return clazz.getDeclaredConstructor();
261-
}
262-
catch (NoSuchMethodException ex) {
263-
// Giving up...
264-
}
257+
258+
// Several constructors -> let's try to take the default constructor
259+
try {
260+
return clazz.getDeclaredConstructor();
261+
}
262+
catch (NoSuchMethodException ex) {
263+
// Giving up...
265264
}
266265

267266
// No unique constructor at all

0 commit comments

Comments
 (0)