<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!--
DispatcherServlet 생성 시 필요한 내용을 정의하는 파일
HandlerMapping : 어떤 요청을 어떤 클래스/메소드로 연결할지 제어하는 객체
<annotation-driven /> 이 @RequestMapping, @GetMapping, @PostMapping을
활성화 해서 HandlerMapping을 대체
ViewResolver: Controller에서 반환된 문자열("common/main") 앞/, 뒤에 경로(/WEB-INF/views/), 확장자(.jsp)를 붙여
jsp 파일의 경로를 지정한 후 forward(요청 위임)을 하는 객체
component-scan : @Component와 자식 어노테이션을 Bean으로 등록하는 태그
, 트랜잭션 관리자, 웹소켓, 인터셉터, 스케줄러
-->
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<!-- wabapp/resources 폴더를 HTTP GET 방식 요청으로 접근할 수 있다. -->
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
<!-- ViewResolver -->
<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<!-- base-packge 이하에 작성된 @Component와
자식 어노테이션(@Controller, @Service, @Repository)이 붙은
클래스를 찾아서 Bean(Spring 관리하는 객체)으로 등록 -->
<context:component-scan base-package="edu.kh.project" />
</beans:beans>
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- Root Context: defines shared resources visible to all other web components -->
<!-- 프로젝트 전반적으로 사용할 DB 연결 관련 내용(JDBC, DBCP, MyBatis), AOP, 트랜젝션 처리, 파일 업로드 등을 작성 -->
</beans>
'괴발개발 > java' 카테고리의 다른 글
| 로그 (0) | 2024.08.24 |
|---|---|
| 스프링 스케쥴러 (0) | 2024.08.23 |
| Srping web.xml 해석 (0) | 2024.08.03 |
| spring 용어 정리 및 mvc 흐름 (0) | 2024.08.02 |
| Spring 파라미터 전달방법 (0) | 2024.08.02 |