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