Skip to content

Resolve context initializers only once in AbstractTestContextBootstrapper #36430

@sbrannen

Description

@sbrannen

Overview

The internal buildMergedContextConfiguration() method in AbstractTestContextBootstrapper originally resolved the ApplicationContextInitializer set only once. However, the changes made in conjunction with #18528 (see commit 2244461) introduced a regression resulting in the initializers being resolved twice: once for validation and once for actually building the merged context configuration. In addition, the resolution for validation does not honor the inheritInitializers flag in ContextConfigurationAttributes.

We should therefore restore the original behavior where initializers are resolved correctly once via ApplicationContextInitializerUtils.resolveInitializerClasses().

Although this is technically a regression, I am labeling this as an enhancement, since the improper validation does not seem to have caused issues in real projects (or at least no one has reported it).

Related Issues

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulestatus: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions