diff --git a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/ParameterAutowireUtils.java b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/ParameterAutowireUtils.java index b6c9c101c1..b9351b9486 100644 --- a/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/ParameterAutowireUtils.java +++ b/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/ParameterAutowireUtils.java @@ -118,7 +118,8 @@ abstract class ParameterAutowireUtils { Autowired autowired = AnnotatedElementUtils.findMergedAnnotation(annotatedParameter, Autowired.class); boolean required = (autowired == null || autowired.required()); - MethodParameter methodParameter = SynthesizingMethodParameter.forParameter(parameter); + MethodParameter methodParameter = SynthesizingMethodParameter.forExecutable( + parameter.getDeclaringExecutable(), parameterIndex); DependencyDescriptor descriptor = new DependencyDescriptor(methodParameter, required); descriptor.setContainingClass(containingClass); return applicationContext.getAutowireCapableBeanFactory().resolveDependency(descriptor, null);