반응형
SMALL

[2] web.xml
(1) web.xml 역할 기능
이 파일은
① root ApplicationContext 와
② servlet ApplicationContext
을 만든다.
(2) web.xml 기능 과정
web.xml 파일에 이벤트처리기 ContextLoaderListener를 이용하여 톰캣이 실행할때
설정내용인 contextConfigLocation 을 연결한 new XmlWebApplicationContext()를 ① Root ApplicationContext를 생성하고
DispatcherServlet 을 이용하여 초기화한 servlet-context.xml 설정을 가진
new XmlWebApplicationConext()를 ② Servlet ApplicationContext 생성한다

(3) web.xml 가 만든 ApplicationContext
① Root ApplicationContext (부모)
부모역할로 공통으로 사용되는 객체를 저장한다
non-web 웹이 아닌 객체, 데이터베이스 객체이다.
② Servlet ApplicationContext (자식)
자식 역할로 개별적으로 사용되는 객체를 저장한다
객체를 찾을때 자식부터 찾은 후 없으면 부모에서 찾는다
자식 Servlet ApplicationContext은 여러개를 만들수도 있다
반응형
LIST
'🌈 백엔드 > 스프링 MVC' 카테고리의 다른 글
| 스프링_Model 속성 추가 @ModelAttribute (0) | 2023.08.23 |
|---|---|
| 스프링_테스트_로깅 Logging (0) | 2023.08.23 |
| 스프링_파라미터 값 가져오기 @RequestParam (0) | 2023.08.23 |
| 스프링_MVC 패턴 원리 이해하기 (0) | 2023.08.12 |
| 스프링_MVC 패턴 기본 구조 (0) | 2023.08.10 |