Change SITestExecListener to prepareTestInstance

It is wrong to try to load an application context before test class in the `TestExecutionListener`

* Change `beforeTestClass()` phase for the `SpringIntegrationTestExecutionListener` to
the `prepareTestInstance()` when other `@BeforeAll` are already executed

**Cherry-pick to 5.5.x**
This commit is contained in:
Artem Bilan
2022-10-19 17:30:15 -04:00
parent a0b13de25d
commit e2d8eeb04d

View File

@@ -28,7 +28,7 @@ import org.springframework.util.PatternMatchUtils;
/**
* A {@link TestExecutionListener} to customize {@link AbstractEndpoint} beans according
* to the provided options in the {@link SpringIntegrationTest} annotation
* before and after test class phases.
* on prepare test instance and after test class phases.
*
* @author Artem Bilan
*
@@ -37,7 +37,7 @@ import org.springframework.util.PatternMatchUtils;
class SpringIntegrationTestExecutionListener implements TestExecutionListener {
@Override
public void beforeTestClass(TestContext testContext) {
public void prepareTestInstance(TestContext testContext) {
SpringIntegrationTest springIntegrationTest =
AnnotatedElementUtils.findMergedAnnotation(testContext.getTestClass(), SpringIntegrationTest.class);