歡迎您光臨本站 註冊首頁

Springboot整合freemarker 404問題解決方案

←手機掃碼閱讀     wooen @ 2020-06-08 , reply:0

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

                                                       

   


[wooen ] Springboot整合freemarker 404問題解決方案已經有350次圍觀

http://coctec.com/docs/java/show-post-237384.html