-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspring-mvc.xml
More file actions
75 lines (66 loc) · 3.61 KB
/
spring-mvc.xml
File metadata and controls
75 lines (66 loc) · 3.61 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- Component-scan으로 베이스 패키지만 바꿔주면 된다. -->
<context:component-scan base-package="hana.ti" />
<!-- 객체 생성과 관련된 Component, Service, 등등을 쓰기 위해 설정 -->
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html; charset=utf-8</value>
<value>application/json; charset=utf-8</value>
</list>
</property>
</bean>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html; charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
<property name="username" value="hr"/>
<property name="password" value="hr"/>
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation" value="classpath:config/mybatis/sqlMapConfig.xml"/>
<property name="mapperLocations" value="classpath:config/sqlmap/oracle/*.xml"/> <!-- 모든 mapper파일이 들어올 수 있게 함 -->
</bean>
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg ref="sqlSessionFactory"/>
</bean>
<mvc:default-servlet-handler />
<!-- 최대업로드사이즈 지정 -->
<bean class="org.springframework.web.multipart.commons.CommonsMultipartResolver" id="multipartResolver">
<property name="maxUploadSize" value="10485760"/>
</bean>
<!--
어떤 요청(uri)이 들어왔을 때, 컨트롤러를 거치지 말고, 그냥 어디로 포워드시켜줘!
즉, 컨트롤러 없이 매핑하는 방식 = view-controller
-->
<mvc:view-controller path="/file/fileUploadForm.do" view-name="file/fileUploadForm"/>
<!-- 요청은 서블릿이 받으면 jsp가 응답할 것이기 때문에 suffix를 .jsp를 써줌. -->
<!-- 그래서 우리는 안써도 되는 것이다. 또 WEB-INF 밑에 만들꺼니까 외부에서 .jsp파일을 접근할 수 없음.
단, 이미지 같은 것들은 WEB-INF 밑에 있으면 접근할 수 없으므로 생각하고 만들어야 함. -->
<mvc:view-resolvers> <!-- 컨트롤러 없어 매핑시키는 것임!!! -->
<mvc:jsp prefix="/WEB-INF/jsp/" suffix=".jsp" />
</mvc:view-resolvers>
<!-- 인터셉터와 관련 -->
<bean class="hana.ti.interceptor.LoginInterceptor" id="loginInterceptor"/>
</beans>