SpringBoot中使用模板引擎freemarker报错404

真的想吐槽一下,浪费我时间:在这里插入图片描述由此可见访问路径是没错的:

@Controller
@RequestMapping("/pay")
public class payController {

    @Autowired
    private OrderService orderService;

    @GetMapping("/create")
    public ModelAndView create() throws UnsupportedEncodingException {
     return new ModelAndView("pay/haha");
    }
}

原因:
版本问题,SpringBoot版本升级后,他的默认后缀不再是ftl,而是ftlh

如果还想用ftl,需要在application.properties文件中配置:

spring.freemarker.suffix=.ftl
发布了665 篇原创文章 · 获赞 115 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/qq_42764468/article/details/104826820