Cannot find template location(s): [classpath:/templates/] 解决templates无法识别,原因是打包没有生成templates文件夹
启动SpringBoot项目出现o.s.b.a.f.FreeMarkerAutoConfiguration - Cannot find template location(s): [classpath:/templates/] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false)
但是我们的目录下又有templates,检查发现是maven打出来的包里没有templates,
解决方法,在pom文件中加入ftl文件的打包,清理一下target重新加载maven,启动就行了。
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.yml</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.ftl</include>-->
</includes>
</resource>
</resources>
</build>