Spring Cloud gateway mvc, virtual threads and threadlocal
With the new spring cloud gateway mvc, and virtual threads enabled - how do i pass use threadlocal information for a single virtual thread? My ask is i want to store the logging id which is unique per request. If mvc handles each request in seperate virtual thread - how do i maintain the context of the virtual thread and where?
I might not fully understand your question, but, as I see in my project on Java 21 and MVC gateway, the context and tracing are passed from the MVC gateway to all the called microservices.
None of this is specific to spring cloud gateway and I don't have any particular knowledge of the combination of virtual threads, org.slf4j.MDC and thread locals.
This stackoverflow looks promising https://stackoverflow.com/questions/77937111/utilizing-logging-mdc-with-virtual-threads