15가지의 필터 중에 가장 상단에 있는 필터 WebAsyncManagerIntegrationFilter
Callable을 사용하게 되면 두번에 거쳐 응답을 하게 되는데
로그를 찍어 보자
public class SecurityLogger {
public static void log(String message) {
System.out.println(message);
Thread thread = Thread.currentThread();
System.out.println(thread.getName());
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
System.out.println(principal);
}
}
@GetMapping("/aync-handler")
@ResponseBody
public Callable<String> asyncHandler() {
SecurityLogger.log("MVC");
return new Callable<String>() {
@Override
public String call() throws Exception {
SecurityLogger.log("Callable");
return "Async Handler";
}
};
}