From e2d8eeb04d3cae896dc18fddf64abd62c332b252 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 19 Oct 2022 17:30:15 -0400 Subject: [PATCH] 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** --- .../test/context/SpringIntegrationTestExecutionListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-integration-test/src/main/java/org/springframework/integration/test/context/SpringIntegrationTestExecutionListener.java b/spring-integration-test/src/main/java/org/springframework/integration/test/context/SpringIntegrationTestExecutionListener.java index 1438d74481..9a90966003 100644 --- a/spring-integration-test/src/main/java/org/springframework/integration/test/context/SpringIntegrationTestExecutionListener.java +++ b/spring-integration-test/src/main/java/org/springframework/integration/test/context/SpringIntegrationTestExecutionListener.java @@ -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);