-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
In what version(s) of Spring Integration are you seeing this issue?
6.5.1
Describe the bug
It appears that MockIntegrationContext.autoStartupCandidates
is updated when SpringIntegrationTestExecutionListener#prepareTestInstance
is called causing a ConcurrentModificationException
. This happens because the method's iteration over AbstractEndpoint
s triggers GatewayMessageHandler#initialize
for any IntegrationFlows
with a gateway, which in turn calls MockIntegrationContext#postProcessBeforeInitialization
to add a new candidate.
Note: in #10018 the GatewayMessageHandler#start
method was updated which indirectly results in MockIntegrationContext#postProcessBeforeInitialization
to be called so I did not see this issue in Spring Integration 6.4.x.
To Reproduce
- Create an IntegrationFlow where it uses a gateway.
- Create a Test with annotations
@SpringBootTest
and@SpringIntegrationTest
. - Run the test and you will see
java.util.ConcurrentModificationException
fromorg.springframework.integration.test.context.SpringIntegrationTestExecutionListener#prepareTestInstance
Expected behavior
The test should not run into a ConcurrentModificationException
. Prior to #10018 we did not call MockIntegrationContext#postProcessBeforeInitialization
when a gateway was found on an IntegrationFlow
.
Sample