1.添加依赖
org.springframework.boot spring-boot-starter-freemarker
2.添加配置文件
spring.freemarker.allow-request-override=false spring.freemarker.check-template-location=true spring.freemarker.charset=utf-8 spring.freemarker.content-type=text/html spring.freemarker.cache=true spring.freemarker.expose-request-attributes=false spring.freemarker.expose-session-attributes=false spring.freemarker.expose-spring-macro-helpers=false #spring.freemarker.prefix= spring.freemarker.suffix=.ftl #spring.freemarker.request-context-attribute= #spring.freemarker.settings.*= #spring.freemarker.template-loader-path=classpath:/template/ #comma-separated list #spring.freemarker.view-names=#whitelist of view names that can be resolved
3.添加页面helloFtl.ftl
Hello World! Hello Freemarker ${name}