우당탕탕 개발자 되기
Spring MVC 본문
MVC 프로젝트를 구성해서 사용한다는 의미
- 내부적으로 root-context.xml 로 사용하는 일반 JAVA 영역과 servlet-context.xml로 설정하는 Web 관련 영역을 같이 연동해서 구동하게된다.
프로젝트 구동시 관여하는 XML
-web.xml : Tomcat 구동과 관련된 설정
-root-context.xml : 스프링과 관련된 설정
-servelt-context.xml : 스프링과 관련된 설정
web.xml : 프로젝트 구동의 시작
-web.xml 의 상단에는 가장 먼저 구동되는 Context Listener 가 등록
<context-param>에는 root-context.xml의 경로가 설정되어 있고, <listener>에는 스프링 MVC의 ContextLoaderListener는 해당 웹 어플리케이션 구동시 같이 동작하므로 해당 프로젝트를
<!-- 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>
root-context.xml 이 처리되면 파일에 있는 Bean 설정들이 동작을 하게된다.
스프링의 기본사상
-Servlet/JSP 에서는 HttpServletRequest/HttpServeltResponse 라는 타입의 객체를 이용해 브라우저에서 전송한 정보를 처리하는 방식.
스프링 MVC의 경우 개발자는 Servlet/JSP의 API 에 신경 쓰지않고 웹어플리케이션을 제작하는 하나의 계층을 위에 더한 형태.
스프링 MVC는 '모델2' 라는 방식으로 처리되는 구조
모델2 : 로직과 화면을 분리하는 스타일의 개발 방식
'Spring' 카테고리의 다른 글
| Spring MVC-Controller(3) (0) | 2021.02.10 |
|---|---|
| Spring MVC-Controller(2) (0) | 2021.02.09 |
| Spring MVC -Controller (0) | 2021.02.09 |
| 의존성 주입 테스트 -Setter (0) | 2021.02.04 |
| SpringFrame Work (0) | 2021.02.04 |