1.查看application.properties
spring.freemarker.cache=false
spring.freemarker.charset=UTF-8
spring.freemarker.check-template-location=true
spring.freemarker.content-type=text/html
spring.freemarker.expose-request-attributes=true
spring.freemarker.expose-session-attributes=true
spring.freemarker.request-context-attribute=request
spring.freemarker.tempalte-loader-path=classpath:/templates
spring.resources.static-locations=classpath:/templates/,classpath:/static/,classpath:/resources/static/
spring.mvc.static-path-pattern=/static/**
spring.freemarker.suffix=.ftl
2.controller要在启动类的同级或子级的包下
3.查看pom.xml,加上**/*.ftl
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*.properties</include>
<include>*.xml</include>
<include>**/*.html</include>
<include>**/*.ftl</include>
<include>static/**</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>