Correlated Logs in Spring Apps with Reactive Parts
summary
Reactive requests that lose MDC correlation are fixed by plugging in a context-propagation layer: add Reactor 3.5 context-propagation, register a ThreadLocalAccessor that reads/writes the MDC CID, and enable the automatic propagation Hook so WebClient callbacks and blocked results restore MDC across thread boundaries. A demo converts Spring Boot 3 MVC to WebFlux, shows the missing CID reappearing in the downstream log, and shows you can instead add the Micrometer tracing bridge to get TraceID/SpanID without custom code.
AI-written summary · about
chapters (13)
- 0:00Introduction to reactive logging
- 1:28MDC and correlation IDs
- 4:15Problem with reactive logging
- 6:23Context propagation solution
- 9:17Demo with context propagation
- 10:21Configuring thread-local accessor
- 12:04Reactive endpoints in MVC
- 12:46Converting to WebFlux
- 15:17Boilerplate reduction with Micrometer
- 16:43Micrometer tracing integration
- 18:32Final demo with tracing
- 19:15Summary and recommendations
- 20:19Resources and Q&A








