<!-- 上传文件并限制大小为-->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="100485760" />
</bean>
<!-- 全局异常处理 -->
<bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<props>
<!-- 处理超过大小时的异常 -->
<!--遇到MaxUploadSizeExceededException异常时,自动跳转到/WEB-INF/views/errors/upload.jsp页面 -->
<prop key="org.springframework.web.multipart.MaxUploadSizeExceededException">errors/upload</prop>
<prop key="java.lang.Throwable">errors/error</prop>
</props>
</property>
<property name="statusCodes">
<props>
<prop key="errors/500">500</prop>
<prop key="errors/404">404</prop>
</props>
</property>
<!-- 设置日志输出级别,不定义则默认不输出警告等错误日志信息 -->
<property name="warnLogCategory" value="WARN"></property>
<!-- 默认错误页面,当找不到上面mappings中指定的异常对应视图时,使用本默认配置 -->
<property name="defaultErrorView" value="errors/error"></property>
<!-- 默认HTTP状态码 -->
<property name="defaultStatusCode" value="500"></property>
</bean>