Cannot find template location(s): [classpath:/templates/] 解决templates无法识别,原因是打包没有生成templates文件夹

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>

在这里插入图片描述
在这里插入图片描述

同理CSS、JS、HTML文件没有就在POM文件里加配置

在这里插入图片描述

网上沙比太多,全尼玛说取消配置文件检查,把告警隐藏了,来网上搜问题的怎么可能只是简单的隐藏,无语了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值