web.xml
비Web 정보(root-context.xml)
model, aop, db, ...
Web 정보(servlet-context.xml)
servlet, controller, annotation, filter, interceptor, viewController, ...
실행 순서
1. 웹 어플리케이션이 실행되면 Tomcat(WAS)에 의해 web.xml이 loading.
2. web.xml에 등록되어 있는 ContextLoaderListener (Java Class)가 생성. ContextLoaderListener class는
ServletContextListener interface를 구현하고 있으며, ApplicationContext를 생성하는 역할을 수행.
3. 생성된 ContextLoaderListener는 root-context.xml을 loading.
4. root-context.xml에 등록되어 있는 Spring Container가 구동. 이 때 개발자가 작한 Business Logic(Service)에 대한 부분과 Database Logic(DAO), VO 객체들이 생성.
5. Client로 부터 요청(request)가 들어옴.
6. DispatcherServlet(Servlet)이 생성. DispatcherServlet은 FrontController의 역할을 수행.
Client로부터 요청 온 메시지를 분석하여 알맞은 PageController에게 전달하고 응답을 받아 요청에 따른 응답을 어떻게 할 지 결정. 실질적인 작업은 PageController에서 이루어 진다. 이러한 클래스들을 HandlerMapping, ViewResolver Class라고 함.
7. DispatcherServlet은 servlet-context.xml을 loading.
8. 두번째 Spring Container가 구동되며 응답에 맞는 PageController들이 동작. 이 때 첫번째 Spring Container가 구동되면서생성된 DAO, VO, Service 클래스들과 협업하여 알맞은 작업을 처리.
'Backend > Spring' 카테고리의 다른 글
[Spring] Lombok (0) | 2022.10.27 |
---|---|
[Spring] MyBatis와 MyBatis-Spring 적용 (0) | 2022.10.21 |
[Spring] Spring MVC 패턴 적용 (0) | 2022.10.21 |
[Spring] Spring UTF8 한글 설정 (0) | 2022.10.21 |
[Spring] Interceptor에 대해 (0) | 2022.10.21 |