spring-boot整合freemarker 出现404

今天遇到了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

猜你喜欢

转载自www.cnblogs.com/orange-time/p/12961990.html