springMVC-servlet.xml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  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"/>
  12. <context:property-placeholder location="classpath:config.properties"/>
  13. <!-- thymeleaf视图 -->
  14. <bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
  15. <property name="order" value="0"/>
  16. <property name="prefix" value="${zheng.ui.path}"/>
  17. <property name="suffix" value=""/>
  18. <property name="templateMode" value="HTML"/>
  19. <property name="cacheable" value="false"/>
  20. <property name="characterEncoding" value="UTF-8"/>
  21. <!--<property name="cacheable" value="true"/>-->
  22. <!--<property name="cacheTTLMs" value="10000"/>-->
  23. </bean>
  24. <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
  25. <property name="templateResolver" ref="templateResolver"/>
  26. <property name="enableSpringELCompiler" value="true"/>
  27. </bean>
  28. <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
  29. <property name="templateEngine" ref="templateEngine"/>
  30. <property name="characterEncoding" value="UTF-8"/>
  31. <property name="viewNames" value="*.html"/>
  32. </bean>
  33. </beans>