【注意】不进行配置的话,controller会找不到页面路径
springboot Thymeleaf
1 2 3 4 5
|
<!-- ThymeLeaf 依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
|
application.yml
1 2 3 4 5 6 7 8 9 10 11 12 13
|
###ThymeLeaf配置 spring: thymeleaf: #模板的模式,支持 HTML, XML TEXT JAVASCRIPT mode: HTML5 #编码 可不用配置 encoding: UTF-8 #内容类别,可不用配置 content-type: text/html #开发配置为false,避免修改模板还要重启服务器 cache: false #配置模板路径,默认是templates,可以不用配置 prefix: classpath:/templates
|
application.properties
1 2 3 4 5 6 7 8 9 10
|
#thymeleaf配置 spring.thymeleaf.mode=HTML5 spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.content-type=text/html spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix=.html #热部署文件,页面不产生缓存,及时更新 spring.thymeleaf.cache=false spring.resources.chain.strategy.content.enabled=true spring.resources.chain.strategy.content.paths=/**
|
spring-boot-starter-thymeleaf版本配置
spring-boot-starter-thymeleaf maven各版本
thymeleaf单独版本配置
1 2 3 4 5
|
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <thymeleaf.version>3.0.0.RELEASE</thymeleaf.version> <thymeleaf-layout-dialect.version>2.0.0</thymeleaf-layout-dialect.version> </properties>
|
近期评论