Spring Boot集成thymeleaf模板引擎

2019-07-18  本文已影响0人  Xiewb

添加依赖

<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
上一篇 下一篇

猜你喜欢

热点阅读