Attiwell 프로젝트 서버실행 흐름 web.xml

jaeyong Lee·2024년 7월 7일
0

서버가 실행 -> web.xml부터 시작


1.filter
모든 경로에 UTF-8적용
  <filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>
            org.springframework.web.filter.CharacterEncodingFilter
    </filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>


2. spring context 설정 -> spring 전역설정을 mybatis-context.xml로 하겠다. 
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring/mybatis-context.xml</param-value>
  </context-param>
  <listener>
    
    
  context-param(spring context설정)에서 지정한 설정 파일 로드
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>



3. dispatcherServlet 설정 
spring mvc 핵심 서블릿 -> dispatcher 설정파일 servlet-context.xml설정
경로 : / -> 모든 경로에 dispatcher servlet 적용
load on start : 서블릿들 사이에서 첫번째로 초기화
  <servlet>
    <servlet-name>appServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>appServlet</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
</web-app>

2. mybatis

https://velog.io/@lee41180612/Attiwell-mybatis

3. dispatcher = servlet - context

https://velog.io/@lee41180612/Attiwell-%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8-%EC%84%9C%EB%B2%84%EC%8B%A4%ED%96%89-%ED%9D%90%EB%A6%84

핵심) servlet context 가 디스패처이고 springcontext에는 mybatis , 근데 이 모든 시작은 web.xml에서 적용시켰다.

0개의 댓글

관련 채용 정보