栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Warn:Cannot find template location: classpath:/templates/

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Warn:Cannot find template location: classpath:/templates/

启动加入Thymeleaf依赖启动器的一个Spring Boot项目后,控制台日志出现警告信息:Cannot find template location: classpath:/templates/…


1、警告信息
...
2021-10-13 15:35:39.086  WARN 21460 --- [  restartedMain] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
...

2、原因分析

templates找不到相关文件。


3、解决方案 3.1、全局配置文件

在全局配置文件application.properties或application.yml中加入以下内容可让该警告提示不再出现。

########################################################
###Thymeleaf
########################################################
#spring.thymeleaf.check-template=false
#spring.thymeleaf.check-template-location=false

3.2、模版文件

在templates目录新建一个*.html的文件作为模版文件后,重新运行主启动类Application,该警告提示不再出现。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/343756.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号