스프링부트 - 비동기 처리
구성
- com.example.tldspringboot.async.controller.ApiController
- com.example.tldspringboot.async.service.AsyncService
- com.example.tldspringboot.TldSpringBootApplication
Step1.
*Application.java 파일에 @EnableAsync Annotation을 추가
Step2.
ApiController.java
Step3.
ApiService.java
Step4.결과
Request에 대한 Response를 위해서는 CompletableFuture 클래스 타입으로 실행한다. (여러개의 Thread를 실행하는 경우)
- AsyncService
- AsyncApiController.java