springmvc-config.xml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:mvc="http://www.springframework.org/schema/mvc"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xmlns:aop="http://www.springframework.org/schema/aop"
  6. xmlns:tx="http://www.springframework.org/schema/tx"
  7. xmlns:context="http://www.springframework.org/schema/context"
  8. xsi:schemaLocation="http://www.springframework.org/schema/beans
  9. http://www.springframework.org/schema/beans/spring-beans.xsd
  10. http://www.springframework.org/schema/mvc
  11. http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
  12. http://www.springframework.org/schema/aop
  13. http://www.springframework.org/schema/aop/spring-aop.xsd
  14. http://www.springframework.org/schema/tx
  15. http://www.springframework.org/schema/tx/spring-tx.xsd
  16. http://www.springframework.org/schema/context
  17. http://www.springframework.org/schema/context/spring-context.xsd">
  18. <context:component-scan base-package="bank.controller"/>
  19. <context:component-scan base-package="bank.service"/>
  20. <mvc:annotation-driven/>
  21. <mvc:default-servlet-handler/>
  22. <!-- 配置登录拦截器,bank.interceptoe.LoginInterceptor.java -->
  23. <mvc:interceptors>
  24. <mvc:interceptor>
  25. <!-- 拦截所有请求 -->
  26. <mvc:mapping path="/**"/>
  27. <!-- 拦截/js,/css,/fonts,/images下的所有请求 -->
  28. <mvc:exclude-mapping path="/js/**"/>
  29. <mvc:exclude-mapping path="/css/**"/>
  30. <mvc:exclude-mapping path="/fonts/**"/>
  31. <mvc:exclude-mapping path="/images/**"/>
  32. <!-- 指定拦截器类 -->
  33. <bean class="bank.interceptor.LoginInterceptor"/>
  34. </mvc:interceptor>
  35. </mvc:interceptors>
  36. <!-- 视图解析器 -->
  37. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  38. <property name="prefix" value="/WEB-INF/jsp/"/>
  39. <property name="suffix" value=".jsp"/>
  40. </bean>
  41. <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
  42. <property name="defaultEncoding" value="utf-8"/>
  43. </bean>
  44. </beans>