如题
1)在pom文件中添加依赖:
<!-- Freemarker 依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
2)配置配置文件:
在application.properties中,配置Freemarker
# Freemarker
spring.freemarker.cache=false
spring.freemarker.request-context-attribute=request
完事~
【注】不添加Freemarker支持后台会报错:
org.thymeleaf.exceptions.TemplateInputException: Error resolving template "login", template might not exist or might not be accessible by any of the configured Template Resolvers……
页面显示:
其他链接
Spring Boot整合Freemarker:https://blog.csdn.net/shicetu/article/details/79353534