码迷,mamicode.com
首页 > 编程语言 > 详细

spring-boot整合freemarker 出现404

时间:2020-05-26 01:34:17      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:mamicode   解决办法   string   request   print   图片   oca   info   span   

今天遇到了ftl整合springboot出现的问题

@Controller
public class IndexController {

    @RequestMapping("hello")
    public String index(){
        System.out.println("aaa");
        return "index";
    }
}

在浏览器输入 localhost:8080/hello   控制台也打印了aaa,index.ftl也写的没有问题。就是出现了这个问题。

技术图片

 

 

解决办法:查看源码,原来默认的是.ftlh结尾的,当然就会出现上面的错误。

技术图片

 

 

 

 

修改办法,在application.properties配置文件中添加如下配置

 

 

spring.freemarker.suffix=.ftl

 

spring-boot整合freemarker 出现404

标签:mamicode   解决办法   string   request   print   图片   oca   info   span   

原文地址:https://www.cnblogs.com/orange-time/p/12961990.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!