Spring Boot 3: SecurityContextHolder returns null in CompletableFuture, works fine in Spring Boot 2
I’m migrating an application from Spring Boot 2 to Spring Boot 3, and I’ve encountered an issue with security context propagation in asynchronous code. I have a REST controller method that executes long-running logic asynchronously using CompletableFuture. Here’s a simplified version of the code: CompletableFuture.supplyAsync(() -> logic()) .thenApply(it -> { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); //