springboot2.1.7整合thymeleaf代码实例
2020-03-11 17:51
543 查看
这篇文章主要介绍了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=/**
以上就是本文的全部内容,希望对大家的学习有所帮助
您可能感兴趣的文章:
相关文章推荐
- spring boot使用thymeleaf跳转页面实例代码
- SpringBoot2.0整合WebSocket代码实例
- Spring Boot整合tk.mybatis代码实例
- Idea下Spring Boot、thymeleaf、Jpa项目整合实例
- spring boot整合spring-kafka实现发送接收消息实例代码
- springboot 整合 freemarker代码实例
- Springboot整合Shiro的代码实例
- Spring Boot中整合Spring Security并自定义验证代码实例
- SpringBoot + Thymeleaf 整合实例讲解
- Spring Boot整合mybatis(一)实例代码
- SpringBoot 整合Jest实例代码讲解
- Spring Boot Cache使用方法整合代码实例
- SpringBoot整合JPA的实例代码
- spring boot 整合 thymeleaf
- rabbitMQ教程(三) spring整合rabbitMQ代码实例
- java鬼混笔记:springboot之thymeleaf 5:模板引入与删除代码
- springboot集成mybatis实例代码
- Spring boot通过AOP防止API重复请求代码实例
- Spring boot项目整合thymeleaf和shiro
- 消息队列 RabbitMQ 与 Spring 整合使用的实例代码