Skip to content

Support fallback parameter resolution extension #1945

Description

Overview

Spring Framework would like to be able to resolve parameters from its ApplicationContext so that users can easily create tests that inject beans. We'd also like to allow any existing ParameterResolver instances to take precedence so that Spring only attempts to resolve parameters that have not been otherwise claimed.

For example, given something like this:

@ExtendWith(SpringExtension.class)
@ExtendWith(MockitoExtension.class)
class MyTest {

    MyTest(@Mock Customer customer, CustomerService service) {
    }
}

We'd like to allow the MockitoExtension to support customer and the SpringExtension to support service.

One option to allow this might be to have a FallbackParameterResolver interface which would be used only if no regular ParameterResolver supports the parameter.

Related Issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions