Skip to content

Exposing a pooled object via a ParameterResolver? #3262

Answered by marcphilipp
roded asked this question in Q&A
Discussion options

You must be logged in to vote
1. When injecting a borrowed object into a `beforeAll` method, the context seems to span the execution of all test methods in the class. This makes sense, but is unfortunate for my purpose since an object will be held for the entire class's duration.

2. Similarly, when injecting a borrowed object into a test class's ctor, it's unclear to me what `ExtensionContext` will be used.

In both cases the class-level context will be used. Have you considered using a @BeforeEach method instead?

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@roded
Comment options

@marcphilipp
Comment options

Answer selected by roded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants