스프링 하위 컨테이너 설정 xml (servlet-context.xml)
코드와 함께 보기 요약본 보러가기 <<클릭
context:component-scan : Scans the classpath for annotated components that will be auto-registered as Spring beans. By default, the Spring-provided @Component, @Repository, @Service, @Controller, @RestController, @ControllerAdvice, and @Configuration stereotypes will be detected.
use-default-filters="false" : Indicates whether automatic detection of classes annotated with @Component, @Repository, @Service, or @Controller should be enabled.
⇒ kr.or.ddit 안에서 스캔을 하긴 하는데 automatic detection은 일단 꺼놓은 상태.
context:include-filter : Controls which eligible types to include for component scanning.
⇒ annotation 중에 Controller, ControllerAdvice인거만 bean으로 자동 등록 됨
<annotation-driven> : web MVC에서 annotation쓰기위해 필요
IRVR(InternalResourceViewResolver): prefix와 suffix를 지정받고 있음 (ViewProcessor의 역할을 할 거라고 유추 가능)
<default-servlet-handler> : Configures a handler for serving static resources by forwarding to the Servlet container's default Servlet. Use of this handler allows using a "/" mapping with the DispatcherServlet while still utilizing the Servlet container to serve static resources. This handler will forward all requests to the default Servlet. Therefore it is important that it remains last in the order of all other URL HandlerMappings.
Tomcat 서버의 web.xml을 보면 모든 정적자원을 처리해주는 defaultServlet이 등록되어있음. 근데 우리가 추가한 dispatcherServlet이 이 defaultServlet의 일을 하려고 함. 근데 이 dispatcherServlet은 지금 껍데기 뿐이라 그러면 안됨. 그래서 이 <default-servlet-handler>를 사용해 그 작업을 서버 컨테이너의 default Servlet으로 forward한다.
multipartResolver: PartWrapper 대용. multipart타입으로 들어오는 요청을 파싱 (web.xml 에 <multipart-config>태그가 꼭 들어가있어야 함)
localeResolver: 웹 접속자의 locale정보를 이용해 language를 쿠키로 저장한다.
languageCookie라는 이름의 쿠키를 7일간 저장한다.
인터셉터: HandlerAdapter와 각 @controller 들 사이에서 필터 역할을 한다.
LocaleChangeInterceptor: 파라미터로 language를 받아서 그 값에 따라 locale을 바꾼다.
WebContentInterceptor: .js로 끝나는 파일, 즉 웹상에서 접근할 수 있는 모든 자원, 정적 자원만 골라 캐시를 남기지 않도록(cacheSeconds=0) 설정 중.
ResourceBundleMessageSource: msgs 안의 message와 CustomValidationMessage 안에 있는 메세지 소스들 bean 등록해두기