코린이의 기록

[Web] Web Application 디렉토리구조(Maven)과 각종 설정파일들 본문

Web

[Web] Web Application 디렉토리구조(Maven)과 각종 설정파일들

코린이예요 2018. 9. 4. 18:55
반응형

우선 Web application의 설정파일들을 보기 전에 프로젝트 폴더 구조를 살펴본다.

Web application의 디렉토리 구조 (Maven)

workspce/[Project Name]

├ src

│   ├ main

│   │   ├─ java

│   │   ├─ resources

│   │   └─ webapp

│   │                ├── static

│   │                └── WEB-INF

│   └ test

│         ├─ java

│         └─ resources

├ target 

└ pom.xml


src/main/java : Java 소스 파일들 

src/test/java : Java Test 파일

resources : properties나 기타 xml 설정파일을 둔다. (ex. datapase.properties, log4j.properties, log4j.xml etc.)

webapp : Web application 설정 파일 

static : css, img, js 파일등

WEB-INF : 웹 어플리케이션 정보 (context.xml, decorators.xml, infrastructure.xml, sitemesh.xml, web.xml 등) 및 jsp 파일을 둔다.

target : 빌드 결과 출력 (.war)

pom.xml : Maven 관련 파일 설정




 파일

 경로

 설명

 web.xml

 src/main/webapp/WEB-INF/

 Deploy Descriptor로 WAS(Web Application Server)가 최초 구동될 때, WEB-INF 디렉토리에 존재하는 web.xml을 읽고 그에 해당하는 Web Application 설정을 구성한다. 즉 각종 설정을 위한 설정파일이다. 

 sitemesh.xml

 src/main/webapp/WEB-INF/

 sitemesh는 웹 페이지의 레이아웃을 효율적으로 처리할 수 있게 도와주는 프레임워크로 이에대한 설정하는 파일이 sitemesh.xml이다.

 pom.xml 

 /

 Maven 관련 파일 설정

 servlet-context.xml

 src/main/webapp/WEB-INF/spring/appSerlvet/

 web application의 client의 요청을 받기 위한 entry point로서의 서블릿의 context 설정

 root-context.xml

 src/main/webapp/WEB-INF/spring/

 web application의 실제 비지니스 혹은 목적을 위한 service layer와 해당 service layer에서 조회 및 처리에 필요한 database 와 연결되는 repository layer를 구성하는 bean들에 대한 설정



Reference

servlet-conetxt.xml 와 root-context.xml의 차이 : http://nice2049.tistory.com/entry/spring-rootContext-%EA%B7%B8%EB%A6%AC%EA%B3%A0-servletContext-%EB%8C%80%ED%95%B4%EC%84%9C


반응형
Comments