ApplicationContext-mvc.xml 2.28 KB
<?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:mvc="http://www.springframework.org/schema/mvc"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd	
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
	
	<mvc:annotation-driven/>	
	<mvc:default-servlet-handler/>
	
	<context:component-scan base-package="com.fh.controller" />
	<context:component-scan base-package="com.json" />

	<!-- 对静态资源文件的访问  restful-->
	<!-- spring 4.3.7 可能会误报红叉,但不影响正常运行 -->   
	<mvc:resources mapping="/admin/**" location="/,/admin/" />
	<mvc:resources mapping="/static/**" location="/,/static/" />
	<mvc:resources mapping="/plugins/**" location="/,/plugins/" />
	<mvc:resources mapping="/uploadFiles/**" location="/,/uploadFiles/" /> 

	<!-- 访问拦截  -->  
  	<mvc:interceptors>
		<mvc:interceptor>
			<mvc:mapping path="/**/**"/>
			<bean class="com.fh.interceptor.LoginHandlerInterceptor"/>
		</mvc:interceptor>
	</mvc:interceptors>
	 
	<!-- 配置SpringMVC的视图解析器 -->
	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/WEB-INF/jsp/"/>
		<property name="suffix" value=".jsp"/>
	</bean>
	
	<bean id="exceptionResolver" class="com.fh.resolver.MyExceptionResolver"></bean>
	
	<!-- 上传拦截,如最大上传值及最小上传值  104857600 104857600 -->
	<!--   <bean id="multipartResolver"   class="org.springframework.web.multipart.commons.CommonsMultipartResolver" >    -->
	  <bean id="multipartResolver"   class="com.fh.controller.api.CustomMultipartResolver" >   
		  <property name="maxUploadSize">    
	          <value>10737418240</value>    
	       </property>   
	        <property name="maxInMemorySize">    
	            <value>4096</value>    
	        </property>   
	         <property name="defaultEncoding">    
	            <value>utf-8</value>    
	        </property> 
    </bean>  
	
</beans>