Skip to main content
InterviewHubPRO
Section Overview
Q47

Question 47 of 50

Part 3: Microservices, Distributed Systems & Observability (25 - 35)

94%
Spring Boot & Microservices (50 Qs)•Part 3: Microservices, Distributed Systems & Observability (25 - 35)

Asynchronous Execution with `@Async` and Context Propagation.

senior LevelAsync & PromisesSystem DesignMicroservices

In Simple Words: Annotating a method with @Async executes it on a background thread pool:

  • SecurityContext Loss: Thread-local state (SecurityContextHolder, MDC correlation IDs) does not automatically transfer to the async thread!
  • Fix: Configure a DelegatingSecurityContextAsyncTaskExecutor to propagate security tokens and trace IDs to the background thread.