美文网首页
Spring Boot集成thymeleaf模板引擎

Spring Boot集成thymeleaf模板引擎

作者: Xiewb | 来源:发表于2019-07-18 15:59 被阅读0次

添加依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
    <groupId>net.sourceforge.nekohtml</groupId>
    <artifactId>nekohtml</artifactId>
</dependency>

application.yml配置thymeleaf相关属性

spring:
  thymeleaf:
    #开发时设为false关闭缓存,便于调试,生产环境为true
    cache: false
    prefix: classpath:/templates/
    suffix: .html
    encoding: UTF-8
    content-type: text/html
    #声明thymeleaf使用非严格的html
    mode: LEGACYHTML5

相关文章

网友评论

      本文标题:Spring Boot集成thymeleaf模板引擎

      本文链接:https://www.haomeiwen.com/subject/levllctx.html