问题描述
org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'TmNewsAction'definedinServletContextresource[/WEB-INF/applicationContext.xml]:Errorsettingpropertyvalues;nestedexceptionisorg.springframework.beans.PropertyBatchUpdateException;nestedPropertyAccessExceptions(1)are:PropertyAccessException1:org.springframework.beans.TypeMismatchException:Failedtoconvertpropertyvalueoftype[com.skeyedu.entity.TmNews]torequiredtype[com.skeyedu.action.teacher.news.TmNewsAction]forproperty'tmNews';nestedexceptionisjava.lang.IllegalArgumentException:Cannotconvertvalueoftype[com.skeyedu.entity.TmNews]torequiredtype[com.skeyedu.action.teacher.news.TmNewsAction]forproperty'tmNews':nomatchingeditorsorconversionstrategyfoundCausedby:org.springframework.beans.PropertyBatchUpdateException;nestedPropertyAccessExceptiondetails(1)are:PropertyAccessException1:org.springframework.beans.TypeMismatchException:Failedtoconvertpropertyvalueoftype[com.skeyedu.entity.TmNews]torequiredtype[com.skeyedu.action.teacher.news.TmNewsAction]forproperty'tmNews';nestedexceptionisjava.lang.IllegalArgumentException:Cannotconvertvalueoftype[com.skeyedu.entity.TmNews]torequiredtype[com.skeyedu.action.teacher.news.TmNewsAction]forproperty'tmNews':nomatchingeditorsorconversionstrategyfoundCausedby:java.lang.IllegalArgumentException:Cannotconvertvalueoftype[com.skeyedu.entity.TmNews]torequiredtype[com.skeyedu.action.teacher.news.TmNewsAction]forproperty'tmNews':nomatchingeditorsorconversionstrategyfound
解决方案
解决方案二:
ssh搭建了一个框架,框架可运行无错,但是写了一条新闻添加的内容就报这个错。
解决方案三:
你看看'TmNewsAction'这个bean里的成员属性,是不是也有对应的bean,其类型是否匹配(注意引入包路径)?
解决方案四:
Cannotconvertvalueoftype[com.skeyedu.entity.TmNews]torequiredtype[com.skeyedu.action.teacher.news.TmNewsAction]forproperty'tmNews'貌似com.skeyedu.action.teacher.news.TmNewsAction中tmNews属性注入有问题,检查一下配置TmNewsAction这个action的配置。