搭建springmvc结合thymeleaf报错,templateresolver无法被创建

在配置Springmvc与Thymeleaf集成时遇到错误,具体为SpringResourceTemplateResolver Bean初始化失败,原因是属性转换异常。尝试了网上的多种解决方案但未见效。问题定位为templateresolver在创建bean时出错,解决办法是将所有maven依赖库导入到lib目录,并确保应用该更改。如果问题仍然存在,建议重复此步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在搭建springmvc框架结合thymeleaf报错

Error creating bean with name 'org.thymeleaf.spring5.templateresolver. SpringResourceTemplateResolver#2ab18723' 
defined in class path resource [springMVC.xml]: Initialization of bean failed;  nested exception 
is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 
'java.lang. String' to required type 'org.thymeleaf.templatemode. TemplateMode' for property 'templateMode'; 
 nested exception is java.lang.IllegalStateException: Cannot convert value of type
 'java.lang. String' to required type 'org.thymeleaf.templatemode. TemplateMode' for property 
'templateMode': no matching editors or conversion strategy found
 

大致上就是这种报错信息,看了网上很多的解决方法,但是都不管用,而且基本上都是一样的,感觉就像是同一个人不同的账号发布的一样,我的报错是templateresolver创建bean时出错,解决方法如下:新建lib,把搭建框架用到的maven包全部放进去,最后apply就可以,如果不管用的话,就在进来试一次。

 

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值