Framework/Spring [java]
[spring] servlet-context.xml
trueman
2021. 12. 23. 00:19
728x90
728x90
servlet-context.xml 파일은 DispacherServlet의 기반 설정을 기록하는 파일이다.
<?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">
<!--
servlet-context.xml(DispatcherServlet Context)
: DispatcherServlet의 기반 설정을 기록하는 파일
-->
<!-- 자바의 어노테이션 문법을 해석하게 하는 코드 (기본으로 등록되어있음) -->
<annotation-driven />
<!--
정적 자원(화면에 보여주기위한)을 매핑해 주는 코드(절대경로를 짧게 만들어주는 목적)
location 위치에 있는 것을 사용할 때 mapping처럼 사용하겠다.
-->
<resources mapping="/resources/**" location="/resources/" />
<!-- 뷰 리졸버 설정 -->
<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>
<!-- 객체를 주입할 때 이하의 패키지에서 검색하겠다. -->
<context:component-scan base-package="com.spring.myapp" />
</beans:beans>
출처 : https://yeahajeong.tistory.com/49?category=957804
[SpringMVC] 초기 설정 - servlet-context.xml
servlservlet-context.xml 앞에서 servlet-context.xml 파일의 이름을 servlet-config.xml로 변경하였다. 이 파일은 DispacherServlet의 기반 설정을 기록하는 파일이다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16..
yeahajeong.tistory.com
728x90
728x90