Overview
The resolveDependency() utility method in ParameterResolutionDelegate resolves a dependency using the name of the parameter as a fallback qualifier. That suffices for most use cases; however, there are times when a custom parameter name should be used instead.
For example, for our Bean Override support in the Spring TestContext Framework, an annotation such as @MockitoBean("myBean") specifies an explicit name that should be used instead of the name of the annotated parameter.
Furthermore, introducing support for custom parameter names will greatly simplify the logic in SpringExtension that will be required to implement #36096.
Related Issues
Overview
The
resolveDependency()utility method inParameterResolutionDelegateresolves a dependency using the name of the parameter as a fallback qualifier. That suffices for most use cases; however, there are times when a custom parameter name should be used instead.For example, for our Bean Override support in the Spring TestContext Framework, an annotation such as
@MockitoBean("myBean")specifies an explicit name that should be used instead of the name of the annotated parameter.Furthermore, introducing support for custom parameter names will greatly simplify the logic in
SpringExtensionthat will be required to implement #36096.Related Issues
@MockitoBeanand@MockitoSpyBeanon test constructor parameters #36096