|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2019 the original author or authors. |
| 2 | + * Copyright 2002-2020 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -202,7 +202,6 @@ public BeanWrapper autowireConstructor(String beanName, RootBeanDefinition mbd,
|
202 | 202 | LinkedList<UnsatisfiedDependencyException> causes = null;
|
203 | 203 |
|
204 | 204 | for (Constructor<?> candidate : candidates) {
|
205 |
| - |
206 | 205 | int parameterCount = candidate.getParameterCount();
|
207 | 206 |
|
208 | 207 | if (constructorToUse != null && argsToUse != null && argsToUse.length > parameterCount) {
|
@@ -515,8 +514,8 @@ public BeanWrapper instantiateUsingFactoryMethod(
|
515 | 514 | LinkedList<UnsatisfiedDependencyException> causes = null;
|
516 | 515 |
|
517 | 516 | for (Method candidate : candidates) {
|
518 |
| - |
519 | 517 | int parameterCount = candidate.getParameterCount();
|
| 518 | + |
520 | 519 | if (parameterCount >= minNrOfArgs) {
|
521 | 520 | ArgumentsHolder argsHolder;
|
522 | 521 |
|
@@ -679,7 +678,7 @@ private int resolveConstructorArguments(String beanName, RootBeanDefinition mbd,
|
679 | 678 | throw new BeanCreationException(mbd.getResourceDescription(), beanName,
|
680 | 679 | "Invalid constructor argument index: " + index);
|
681 | 680 | }
|
682 |
| - if (index > minNrOfArgs) { |
| 681 | + if (index + 1 > minNrOfArgs) { |
683 | 682 | minNrOfArgs = index + 1;
|
684 | 683 | }
|
685 | 684 | ConstructorArgumentValues.ValueHolder valueHolder = entry.getValue();
|
|
0 commit comments