首页 > 编程语言 > 详细

SpringBoot使用thymeleaf模板引擎

时间:2019-01-26 13:00:46      阅读:264      评论:0      收藏:0      [点我收藏+]

(1)、添加pom依赖

  

1         <dependency>
2             <groupId>org.springframework.boot</groupId>
3             <artifactId>spring-boot-starter-thymeleaf</artifactId>
4         </dependency>

 

  *  SpringBoot1.x 默认的thymeleaf版本低,如果要自定义版本,需要在pom properties 覆写SpringBoot默认的thymeleaf版本号

  

1     <properties>
2         <thymeleaf.version>3.0.11.RELEASE</thymeleaf.version>
3         <!--thymeleaf3需要布局功能layout2以上版本-->
4         <thymeleaf-layout-dialect.version>2.3.0</thymeleaf-layout-dialect.version>
5     </properties>

  

  *  SpringBoot2.x 无需此操作

 

(2)、将Html页面放至classpath:/templates/下,thymeleaf模板引擎将自动渲染

 

SpringBoot使用thymeleaf模板引擎

原文:https://www.cnblogs.com/fanqisoft/p/10323136.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!