一、添加依赖

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>

二、Application.properties配置
 

spring.freemarker.cache=false
spring.freemarker.charset=UTF-8
spring.freemarker.content-type=text/html
spring.freemarker.suffix=.ftl
spring.freemarker.template-loader-path=classpath:/templates
spring.freemarker.request-context-attribute=request

三、设置模版路径
resources路径下创建文件夹:templates
四、创建模版文件
1.后缀名:ftl
2.模版文件:view.ftl
3.index.ftl内容:你好 freemarker

@RequestMapping("/view")
public String view(Model model){
return "view";
}