Spring MVC Async 예제 (example)
참고자료.
http://static.springsource.org/spring/docs/3.0.5.RELEASE/reference/scheduling.html
beans-task.xml 생성. executer 정의
beans.xml 에 추가 . ( 위치 중요)
<import resource="classpath:/beans-task.xml" /> |
@Async 할 클래스 추가 (기존 Bean이 아닌 새로운 Bean으로 정의하니 동작함.)
import java.util.ArrayList; import org.springframework.beans.factory.annotation.Autowired;
@Service // 작업 } |
Controller에 추가.
@Controller
@AutoWired AsyncProcessService asyncService;
@RequestMapping(value = "/event", method = {RequestMethod.POST, RequestMethod.GET}) asyncService.processNotifications(newSendEventList); } } |