Spring Boot整合freemarker;Spring Boot 整合freemarker报错

怎么整合freemarker

依赖 pom.xml
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
配置 application.yml
spring:
  freemarker:
    suffix: .ftl
Controller
@GetMapping("/create")
public ModelAndView create(){
    Map map = new HashMap();
    map.put("codeUrl","xxxxxxxx);
    return new ModelAndView("create",map);
}

和平时写thymeleaf一样写Controller

模板位置
/resources/templates/

把 .ftl 的文件写在这个里面。

Spring Boot 整合freemarker报错

解决方法:

spring:
  freemarker:
    suffix: .ftl
发布了33 篇原创文章 · 获赞 15 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_35764460/article/details/103976734