<?xml version="1.0" encoding="UTF-8"?>
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
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-4.0.xsd
|
http://www.springframework.org/schema/mvc
|
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
|
|
<!-- 注解扫描包 -->
|
<context:component-scan base-package="com.basic,framework" />
|
|
<!-- 开启注解 -->
|
<mvc:annotation-driven>
|
<mvc:message-converters>
|
<!-- @ResponseBody String 返回时,解决中文乱码 -->
|
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
|
<property name="supportedMediaTypes">
|
<list>
|
<value>text/plain;charset=UTF-8</value>
|
<value>text/html;charset=UTF-8</value>
|
</list>
|
</property>
|
</bean>
|
</mvc:message-converters>
|
|
</mvc:annotation-driven>
|
|
<!--
|
配置静态资源,直接映射到对应的文件夹,不被DispatcherServlet处理,3.04新增功能,
|
需要重新设置spring-mvc-3.0.xsd
|
-->
|
<mvc:resources location="/" mapping="/**"/>
|
<mvc:resources mapping="/img/**" location="/img/" />
|
<mvc:resources mapping="/js/**" location="/js/" />
|
<mvc:resources mapping="/css/**" location="/css/" />
|
<mvc:resources mapping="/html/**" location="/html/" />
|
<mvc:resources location="/frame-jsp/" mapping="/frame-jsp/**"/>
|
<mvc:resources location="/web-im-1.0.7.2/" mapping="/web-im-1.0.7.2/**" />
|
<mvc:resources location="/test/" mapping="/test/**" />
|
|
<!-- 定义跳转的文件的前后缀 ,视图模式配置-->
|
<!-- 这里的配置是自动给后面action的方法return的字符串加上前缀和后缀,
|
变成一个 可用的url地址
|
-->
|
<bean id="viewResolver"
|
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
<property name="prefix" value="/WEB-INF/jsp/" />
|
<property name="suffix" value=".jsp" />
|
</bean>
|
|
<!-- 文件上传 org.springframework.web.multipart.commons.CommonsMultipartResolver-->
|
<bean id="multipartResolver"
|
class="framework.fileUpload.MyMultipartResolver">
|
<property name="defaultEncoding" value="utf-8"></property>
|
<property name="maxUploadSize" value="10485760"></property> <!-- 10M -->
|
<property name="maxInMemorySize" value="1024"></property>
|
</bean>
|
|
<!-- 拦截器 -->
|
<mvc:interceptors>
|
<!-- 将request的parameter有选择的放在attribute里 -->
|
<bean class="framework.base.RequestParameterInterceptor"/>
|
<!-- 其他指定的请求
|
<mvc:interceptor>
|
<mvc:mapping path="/**"/>
|
<bean class=""/>
|
</mvc:interceptor>
|
-->
|
</mvc:interceptors>
|
</beans>
|