ApplicationContext-mvc.xml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:mvc="http://www.springframework.org/schema/mvc"
  5. xmlns:context="http://www.springframework.org/schema/context"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
  8. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
  9. <mvc:annotation-driven/>
  10. <mvc:default-servlet-handler/>
  11. <context:component-scan base-package="com.fh.controller" />
  12. <context:component-scan base-package="com.json" />
  13. <!-- 对静态资源文件的访问 restful-->
  14. <!-- spring 4.3.7 可能会误报红叉,但不影响正常运行 -->
  15. <mvc:resources mapping="/admin/**" location="/,/admin/" />
  16. <mvc:resources mapping="/static/**" location="/,/static/" />
  17. <mvc:resources mapping="/mobile/**" location="/,/mobile/" />
  18. <mvc:resources mapping="/plugins/**" location="/,/plugins/" />
  19. <mvc:resources mapping="/uploadFiles/**" location="/,/uploadFiles/" />
  20. <mvc:resources location="/activiti-editor/" mapping="/activiti-editor/**" />
  21. <!-- 访问拦截 -->
  22. <mvc:interceptors>
  23. <mvc:interceptor>
  24. <mvc:mapping path="/**/**"/>
  25. <bean class="com.fh.interceptor.LoginHandlerInterceptor"/>
  26. </mvc:interceptor>
  27. </mvc:interceptors>
  28. <!-- 配置SpringMVC的视图解析器 -->
  29. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  30. <property name="prefix" value="/WEB-INF/jsp/"/>
  31. <property name="suffix" value=".jsp"/>
  32. </bean>
  33. <bean id="exceptionResolver" class="com.fh.resolver.MyExceptionResolver"></bean>
  34. <!-- 上传拦截,如最大上传值及最小上传值 -->
  35. <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" >
  36. <property name="maxUploadSize">
  37. <value>104857600</value>
  38. </property>
  39. <property name="maxInMemorySize">
  40. <value>4096</value>
  41. </property>
  42. <property name="defaultEncoding">
  43. <value>utf-8</value>
  44. </property>
  45. </bean>
  46. </beans>