async한 기능과 security가 어떻게 동작하는지 살펴보자.
@Async 서비스를 호출해 보자.
SampleService
@Async
public void asyncService() {
SecurityLogger.log("inner async service");
System.out.println("async service");
}
SampleController
@GetMapping("/async-service")
@ResponseBody
public String asyncService() {
SecurityLogger.log("MVC, before async service");
sampleService.asyncService();
SecurityLogger.log("MVC, after async service");
return "Async Service";
}
설정이 필요
@SpringBootApplication
@EnableAsync
public class DemoSpringSecurityFormApplication {