티스토리 뷰
web.xml
개발환경셋팅을 직접적으로 하기위해서는 꼭알아두어야하는 web.xml이다.
web.xml에서 URL을 DispatcherServlet으로 맵핑시켜주기전에 더 중요한 설정들이 있다. 그게 바로 web.xml으로 기본적인 설정파일들을 등록시키는 거다.
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<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>
WAS구동시에 web.xml을 읽어들여 웹 어플리케이션 설정을 구성하기위한 즉, 초기셋팅작업이 이뤄지는데 ContextLoaderListener의 역할이다.
ContextLoaderListener는 web.xml에 설정파일들이 모두 load 되도록 등록할때 사용되고, 서블릿 이전에 서블릿을 초기화 시켜주며
contextConfigLocation으로 설정파일들의 위치를 지정시켜준다.
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
개발자가 contextConfigLocation으로 위치를 처음에 지정시켜주지 않으면 기본적으로 web.xml은 root-context.xml로 설정파일 위치를 잡아 준다.
context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
반응형
'FULL STACK > SPRING &EGOV' 카테고리의 다른 글
어노테이션 정리 (0) | 2019.01.22 |
---|---|
스프링 한글깨짐 방지 (0) | 2018.12.21 |
스프링 시큐리티 (0) | 2018.12.13 |
게시판 테이블 엑셀로 변환 (0) | 2018.12.13 |
log4j2 (0) | 2018.12.13 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- fontawesome 4.7
- css
- Slick
- JavaScript
- sliding scroll
- js scroll
- 반응형
- Sliding
- FontAwesome
- jQuery CDN
- html
- jQuery
- getBoundingClientRect
- defer
- Javscript
- fontawesome 4.7 cdn
- scroll
- JS
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함