Thymeleaf 3与Spring MVC 4 整合配置

Thymeleaf 3与Spring MVC 4 整合配置

Maven 依赖配置

Spring 相关依赖就不说了

<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring4</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>

通过三个bean整合,配置如下:

    <!-试图解析器->
<bean id="viewResolver" class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
<property name="order" value="1" />
<property name="characterEncoding" value="UTF-8" />
<property name="templateEngine" ref="templateEngine" />
</bean>
<!-- 配置TemplateEngine -->
<bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
<property name="templateResolver" ref="templateResolver" />
</bean>
<bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
<property name="prefix" value="/WEB-INF/thymeleaf/" />
<property name="suffix" value=".html" />
<property name="templateMode" value="HTML5" />
</bean>
上一篇:批处理添加iis wpg、users对IIS的访问权限


下一篇:CPU卡