SpringBoot整合FreeMarker出现404的解决方法 -- 知识铺
今天遇到了ftl整合springboot出现的问题 <ol><li><span>@Controller</span></li><li><span>public</span><span> </span><span>class</span><span> </span><span>IndexController</span><span> </span><span>{</span></li><li><span> </span></li><li><span> </span><span>@RequestMapping</span><span>(</span><span>"hello"</span><span>)</span></li><li><span> </span><span>public</span><span> </span><span>String</span><span> index</span><span>(){</span></li><li><span> </span><span>System</span><span>.</span><span>out</span><span>.</span><span>println</span><span>(</span><span>"aaa"</span><span>);</span></li><li><span> </span><span>return</span><span> </span><span>"index"</span><span>;</span></li><li><span> </span><span>}</span></li><li><span>}</span></li></ol> 在浏览器输入 localhost:8080/hello 控制台也打印了aaa,index.ftl也写的没有问题。就是出现了这个问题。 解决办法:查看源码,原来默认的是.ftlh结尾的,当然就会出现上面的错误。 修改办法,在application.pro……