Commit cb57c96
committed
Fix
Related to: spring-projects/spring-framework#35168
Spring Framework has introduced recently an optimization for cached contexts.
So, if one is not used, it is stopped in the cache.
When we pull it next time from there, it is restarted.
The `SpringIntegrationTestExecutionListener` ha a flaw to change the state of the endpoints
in the application context, but never reset it back to original.
The problem has become apparent because of not reset auto-startup status of endpoints and that `AC.restart()`
* Fix `SpringIntegrationTestExecutionListener` to use `setAutoStartup(false)`
on `autoStartupCandidates` in the `afterTestClass()`.
This is exactly a state the `MockIntegrationContext` has gathered them in its initialization phase.
* Fix `MockIntegrationContext.autoStartupCandidates` to be a `Set` instead.
The point is that `postProcessBeforeInitialization()` deals with `AbstractEndpoint` beans.
And then `afterSingletonsInstantiated()` also gathers those beans from the `BeanFactory`.
So, with a `Set` we aim for no duplicationsSpringIntegrationTestExecutionListener for restart1 parent c0334ee commit cb57c96
File tree
2 files changed
+14
-12
lines changed- spring-integration-test/src/main/java/org/springframework/integration/test/context
2 files changed
+14
-12
lines changedLines changed: 8 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
115 | | - | |
116 | | - | |
| 116 | + | |
| 117 | + | |
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| |||
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
| 52 | + | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
60 | 59 | | |
61 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
0 commit comments