默认情况下,freemarker视图优先级会高于thymeleaf 。 所有生成视图时会优先生成 freemarker的视图
application.yml加入freemarker配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
freemarker:
allow-request-override: false
cache: false
check-template-location: true
charset: UTF-8
content-type: text/html; charset=utf-8
expose-request-attributes: false
expose-session-attributes: false
expose-spring-macro-helpers: false
suffix: .ftl
template-loader-path: classpath:/templates
application.yml加入thymeleaf配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
thymeleaf:
prefix: classpath:/templates/
suffix: .html
mode: HTML5
encodin: UTF-8
content-type: text/html
cache: false
https://blog.csdn.net/qq_16137795/article/details/89182172
https://www.jianshu.com/p/d24043c485c9