|
31 | 31 |
|
32 | 32 | import io.micrometer.context.ContextRegistry;
|
33 | 33 | import io.micrometer.context.ContextSnapshot;
|
| 34 | +import io.micrometer.context.ContextSnapshotFactory; |
34 | 35 | import org.assertj.core.api.InstanceOfAssertFactories;
|
35 | 36 | import org.junit.jupiter.api.Test;
|
36 | 37 | import reactor.core.publisher.Flux;
|
@@ -403,7 +404,8 @@ void contextPropagation() throws Exception {
|
403 | 404 | GraphQlWebSocketHandler handler = initWebSocketHandler(threadLocalInterceptor);
|
404 | 405 |
|
405 | 406 | // Ensure ContextSnapshot is present in WebSocketSession attributes
|
406 |
| - this.session.getAttributes().put(ContextSnapshot.class.getName(), ContextSnapshot.captureAll()); |
| 407 | + ContextSnapshot snapshot = ContextSnapshotFactory.builder().build().captureAll(); |
| 408 | + this.session.getAttributes().put(ContextSnapshot.class.getName(), snapshot); |
407 | 409 |
|
408 | 410 | // Context should propagate, if message is handled on different thread
|
409 | 411 | Thread thread = new Thread(() -> {
|
@@ -452,7 +454,8 @@ private void handle(GraphQlWebSocketHandler handler, TextMessage... textMessages
|
452 | 454 |
|
453 | 455 | if (!this.session.getAttributes().containsKey(ContextSnapshot.class.getName())) {
|
454 | 456 | // Ensure ContextSnapshot is present in WebSocketSession attributes
|
455 |
| - this.session.getAttributes().put(ContextSnapshot.class.getName(), ContextSnapshot.captureAll()); |
| 457 | + ContextSnapshot snapshot = ContextSnapshotFactory.builder().build().captureAll(); |
| 458 | + this.session.getAttributes().put(ContextSnapshot.class.getName(), snapshot); |
456 | 459 | }
|
457 | 460 |
|
458 | 461 | for (TextMessage message : textMessages) {
|
|
0 commit comments