springboot2.1.7整合thymeleaf代码实例
这篇文章主要介绍了springboot2.1.7整合thymeleaf代码实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
1.在pom里面添加thymeleaf依赖
<!--thymeleaf-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- 使用springboot的thymeleaf模板时默认会对HTML进行严格的检查,导致当你的标签没有闭合时就会通不过,nekohtml这个依赖可以解决这一问题-->
<dependency>
<groupId>nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>${nekohtml.version}</version>
</dependency>
2.添加application.properties配置
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.check-template-location=true
spring.thymeleaf.suffix=.html
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.servlet.content-type=text/html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.cache=false
spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持无名。
同类资源
- 天盾网络验证防破解整合包
天盾网络验证防破解整合包例子源代码,仅供学习参考。...
- 雷电系列模拟器精简工具整合
雷电系列模拟器精简工具整合绿色版,雷电精简工具估计要拖比较久了。...
- 重写tinypng操作整合到自己模块
易语言重写tinypng操作整合到自己模块例子源代码,4行代码,简单明了,像我这种小菜都一眼就看懂。...
- Java基于springboot教务管理系统
Java基于springboot教务管理系统本文件感兴趣的可以参考一下,帮助学校管理教务系统,用一个帐号解决学校教务...
- springBootNoMaven实现定时任务功能
springBootNoMaven本文件感兴趣的可以参考一下,不使用maven环境,创建springboot项目,实现了定时任务功能简单...
- DCKer超级模块整合常用版
易语言DCKer超级模块整合常用版例子源代码,整合了常用所有命令,打造更实用的模块。...
- liburl调用模块整合
易语言liburl调用模块整合例子源代码,实乃整合类源码。...
- SpringBoot健身房管理系统
SpringBoot健身房管理系统绿色版,springboot+MySQL+thymeleaf。...
- 使用springboot2.x整合shiro包含sql数据库
使用springboot2.x整合shiro包含sql数据库例子源代码。...