Constructor parameter resolution order for PER_CLASS vs PER_METHOD

Author: joca-btCreated Sep 15, 2026Updated Sep 15, 2026
Labelstheme: documentationcomponent: Jupitertype: new featurestatus: new

The timing of constructor parameter resolution relative to lifecycle callbacks differs between PER_CLASS and PER_METHOD.

Specifically:

  • With PER_CLASS, constructor parameters are resolved before beforeAll() and beforeEach().

  • With PER_METHOD, constructor parameters are resolved after beforeAll() but before beforeEach().

This can complicate extension development. For example, a ParameterResolver that depends on resources initialized in BeforeAllCallback can work with PER_METHOD but fail with PER_CLASS.

I couldn’t find an explicit explanation of this ordering in the documentation. Could the lifecycle documentation show where test instance creation and constructor parameter resolution occur for each mode?

Perhaps it could also be made uniform between modes?

Source: junit-team/junit-framework