김영한님의 스프링 기본편을 학습하는 도중, 스프링이 동적으로 클라이언트의 요청을 처리하는 과정이 궁금해서 찾아봤습니다.
Web Container == Servlet Container
ServletContainer에서 Thread를 생성해서 사용할 Servlet이 이미 인스턴스로 존재하면 가져와서 사용하고, 없으면 초기화해서 service() 메소드를 실행합니다.
ServletContainer에서 HttpServletRequest, HttpServletResponse 인스턴스도 생성해서 전달해줍니다
Spring은 여기서 WebapplicationContext을 SpringContainer로 인스턴스를 생성해서 가지고 있다가, Servlet이 생성되고 Distpatcher-Servlet으로 SpringContainer안에 Spring Bean으로 생성되어있는 적절한 Controller를 호출하여 요청을 처리합니다.
이미지 출처 : https://stackoverflow.com/questions/4223564/servletconfig-vs-servletcontext
참고 블로그