<?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.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!--通知spring使用cglib而不是jdk的来生成代理方法 AOP可以拦截到Controller
<aop:aspectj-autoproxy proxy-target-class="true"/>
-->
<!--自动扫描--> <context:component-scan base-package="com.jy.rs.controller" /> <!--注解驱动--> <mvc:annotation-driven /> <!-- 配置用户授权拦截器,判断该用户是否可以访问某个URL --> <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**"/> <!-- 如果是用户登录,则不需要判断 --> <mvc:exclude-mapping path="/login"/> <bean class="com.jy.rs.interceptor.UserInterceptor" /> </mvc:interceptor> </mvc:interceptors> <!--映射静态资源--> <mvc:resources mapping="/js/**" location="/WEB-INF/js/"/> <mvc:resources mapping="/img/**" location="/WEB-INF/img/"/> <mvc:resources mapping="/easyui/**" location="/WEB-INF/easyui/"/> <mvc:resources mapping="/images/**" location="/WEB-INF/images/"/> <mvc:resources mapping="/json/**" location="/WEB-INF/json/"/> <mvc:resources mapping="/ueditor/**" location="/WEB-INF/ueditor/"/> <!-- <mvc:resources mapping="/css/**" location="/css/"/> <mvc:resources mapping="/easyui/**" location="/easyui/"/> <mvc:resources mapping="/My97DatePicker/**" location="/My97DatePicker/"/> --> <!--视图解析器--> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/"/> <property name="suffix" value=".jsp"/> </bean>
<!-- 文件上传下载需要的jar包 : commons-io commons-fileupload.jar --> <!-- 文件上传解析器 --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize" value="1000000" /> </bean> <!--避免IE执行AJAX时,返回JSON出现下载文件 --> <!-- <bean id="mappingJacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>text/html;charset=UTF-8</value> </list> </property> </bean> --> </beans>