Error resolving template [xxx], template might not exist or might not be accessible by any of the co

Error resolving template [xxx], template might not exist or might not be accessible by any of the configured Template Resolvers

springboot运行成功之后,访问页面报错,反复查看代码,都没有错误,最后原因是因为给thymeleaf的默认设置进行了自定义设置,但是自定义的时候设置的值又是本来的默认值,导致程序报错:

2020-12-13 16:56:04.753 ERROR 37468 --- [nio-8888-exec-1] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-8888-exec-1] Exception processing template "index": Error resolving template [index], template might not exist or might not be accessible by any of the configured Template Resolvers
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [index], template might not exist or might not be accessible by any of the configured Template Resolvers

其实默认设置有默认值的,自身项目没有改动的,根本不需要修改或者自定义这些设置。spring.thymeleaf下的 prefix、suffix、check-template-location、mode都是有默认值的,如果你的application.properties或者application.yml中设置了这些属性,但是值是默认值的话,删掉这些设置,就不会报错了。

application.properties

# 如果项目没有更改以下属性值,则properties中不需要设置
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.check-template-location=true
spring.thymeleaf.suffix=html
spring.thymeleaf.mode=HTML
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值