Skip to content

Commit

Permalink
Avoid unnecessary parameter name inspection for factory method type c…
Browse files Browse the repository at this point in the history
…heck

Closes gh-30103
See gh-29612
  • Loading branch information
jhoeller committed Mar 10, 2023
1 parent 99e54fe commit 3431b23
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 58 deletions.
Expand Up @@ -754,13 +754,15 @@ protected Class<?> getTypeForFactoryMethod(String beanName, RootBeanDefinition m
if (candidate.getTypeParameters().length > 0) {
try {
// Fully resolve parameter names and argument values.
ConstructorArgumentValues cav = mbd.getConstructorArgumentValues();
Class<?>[] paramTypes = candidate.getParameterTypes();
String[] paramNames = null;
ParameterNameDiscoverer pnd = getParameterNameDiscoverer();
if (pnd != null) {
paramNames = pnd.getParameterNames(candidate);
if (cav.containsNamedArgument()) {
ParameterNameDiscoverer pnd = getParameterNameDiscoverer();
if (pnd != null) {
paramNames = pnd.getParameterNames(candidate);
}
}
ConstructorArgumentValues cav = mbd.getConstructorArgumentValues();
Set<ConstructorArgumentValues.ValueHolder> usedValueHolders = new HashSet<>(paramTypes.length);
Object[] args = new Object[paramTypes.length];
for (int i = 0; i < args.length; i++) {
Expand Down

0 comments on commit 3431b23

Please sign in to comment.