Spring Boot GraphQL Tutorial #35 - MDC Correlation ID

Опубликовано: 20 Февраль 2026
на канале: Philip Starritt
2,860
21

Hi!

Lets revisit the MDC thread context propagation solution from Chapter 26.

Why?

GraphQL version 12.0.0+ executes asynchronously by default. This introduced an additional thread-pool (created inside GraphQLWebSecurityAutoConfiguration or GraphQLWebAutoConfiguration) that will be execute the resolver threads. Previously by default this was the Tomcat NIO thread pool.

The Correlation ID is propagated from the Tomcat NIO Thread to the new thread-pool via a graphql.kickstart.servlet.AsyncTaskDecorator.
The graphql async thread pool will delegate to futher async threads using the org.springframework.core.task.TaskDecorator.
One class MdcContextTaskDecorator implements both interfaces, to keep things simple.

Update custom executor factory to use spring's ThreadPoolTaskExecutor.

Thanks and I hope you enjoyed this video!

PR: https://github.com/philip-jvm/learn-s...