ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๋ฐ˜์‘ํ˜•
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
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?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>
 
 
๋ฐ˜์‘ํ˜•
๋Œ“๊ธ€