springMVC-servlet.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. <mvc:mapping path="/**"/>
  17. <bean class="com.zheng.cms.web.interceptor.CmsWebInterceptor"></bean>
  18. </mvc:interceptor>
  19. </mvc:interceptors>
  20. <context:property-placeholder location="classpath:config.properties"/>
  21. <!-- thymeleaf视图 -->
  22. <bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
  23. <property name="order" value="0"/>
  24. <property name="prefix" value="${zheng-ui.path}"/>
  25. <property name="suffix" value=""/>
  26. <property name="templateMode" value="HTML"/>
  27. <property name="cacheable" value="false"/>
  28. <property name="characterEncoding" value="UTF-8"/>
  29. <!--<property name="cacheable" value="true"/>-->
  30. <!--<property name="cacheTTLMs" value="10000"/>-->
  31. </bean>
  32. <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
  33. <property name="templateResolver" ref="templateResolver"/>
  34. <property name="enableSpringELCompiler" value="true"/>
  35. </bean>
  36. <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
  37. <property name="templateEngine" ref="templateEngine"/>
  38. <property name="characterEncoding" value="UTF-8"/>
  39. <property name="viewNames" value="/${app.name}/*"/>
  40. </bean>
  41. </beans>