spring-mvc.xml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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:context="http://www.springframework.org/schema/context"
  5. xmlns:mvc="http://www.springframework.org/schema/mvc"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans
  7. http://www.springframework.org/schema/beans/spring-beans.xsd
  8. http://www.springframework.org/schema/context
  9. https://www.springframework.org/schema/context/spring-context.xsd
  10. http://www.springframework.org/schema/mvc
  11. https://www.springframework.org/schema/mvc/spring-mvc.xsd">
  12. <context:component-scan base-package="space.anyi.controller"/>
  13. <mvc:annotation-driven/>
  14. <mvc:default-servlet-handler/>
  15. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  16. <property name="prefix" value="/WEB-INF/views/"/>
  17. <property name="suffix" value=".jsp"/>
  18. </bean>
  19. <bean id="multipartResolver"
  20. class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
  21. <property name="maxUploadSize" value="2097152"/>
  22. <property name="defaultEncoding" value="UTF-8"/>
  23. </bean>
  24. <mvc:interceptors>
  25. <mvc:interceptor>
  26. <mvc:mapping path="/**"/>
  27. <mvc:exclude-mapping path="/login"/>
  28. <mvc:exclude-mapping path="/static/**"/>
  29. <bean class="space.anyi.interceptor.LoginInterceptor"/>
  30. </mvc:interceptor>
  31. <mvc:interceptor>
  32. <mvc:mapping path="/admin/**"/>
  33. <bean class="space.anyi.interceptor.AuthInterceptor"/>
  34. </mvc:interceptor>
  35. </mvc:interceptors>
  36. </beans>