springMVC-servlet.xml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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
  7. http://www.springframework.org/schema/beans/spring-beans.xsd
  8. http://www.springframework.org/schema/mvc
  9. http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
  10. <!-- 根目录'/'对应页面 -->
  11. <mvc:view-controller path="/" view-name="/index.jsp"/>
  12. <!-- 拦截器配置 -->
  13. <mvc:interceptors>
  14. <!-- 后台拦截器 -->
  15. <mvc:interceptor>
  16. <!-- 拦截路径 -->
  17. <mvc:mapping path="/manage/**"/>
  18. <!-- 非拦截路径 -->
  19. <mvc:exclude-mapping path="/manage/login"/>
  20. <!-- 拦截器对象 -->
  21. <bean id="manageInterceptor" class="com.zheng.cms.admin.Interceptor.ManageInterceptor"/>
  22. </mvc:interceptor>
  23. </mvc:interceptors>
  24. <context:property-placeholder location="classpath:config.properties"/>
  25. <!-- 使用thymeleaf视图 -->
  26. <bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
  27. <property name="order" value="0"/>
  28. <property name="prefix" value="${zheng-ui.path}"/>
  29. <property name="suffix" value=".html"/>
  30. <property name="templateMode" value="HTML"/>
  31. <property name="cacheable" value="false"/>
  32. </bean>
  33. <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
  34. <property name="templateResolver" ref="templateResolver"/>
  35. <property name="enableSpringELCompiler" value="true"/>
  36. </bean>
  37. <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
  38. <property name="templateEngine" ref="templateEngine"/>
  39. </bean>
  40. </beans>