您的位置:首頁技術文章
文章詳情頁

Springboot整合freemarker 404問題解決方案

瀏覽:6日期:2023-05-15 11:01:28

今天遇到了ftl整合springboot出現的問題

@Controllerpublic class IndexController { @RequestMapping('hello') public String index(){ System.out.println('aaa'); return 'index'; }}

在瀏覽器輸入 localhost:8080/hello 控制臺也打印了aaa,index.ftl也寫的沒有問題。就是出現了這個問題。

Springboot整合freemarker 404問題解決方案

解決辦法:查看源碼,原來默認的是.ftlh結尾的,當然就會出現上面的錯誤。

Springboot整合freemarker 404問題解決方案

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

spring.freemarker.suffix=.ftl

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: Spring
相關文章:
国产综合久久一区二区三区