日期:2014-05-20  浏览次数:20726 次

org.springframework.beans.TypeMismatchException错误
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [cn.edu.tjuci.ei_oa.biz.baseInfo.impl.OfficeInfoBizImpl] to required type [cn.edu.tjuci.ei_oa.bean.OfficeInfo] for property 'officeInfo'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [cn.edu.tjuci.ei_oa.biz.baseInfo.impl.OfficeInfoBizImpl] to required type [cn.edu.tjuci.ei_oa.bean.OfficeInfo] for property 'officeInfo': no matching editors or conversion strategy found

错误分析:在程序中,存在一个与Spring中Bean的Id冲突的类,即名称相同,但是类型不同。并且同时存在set和get方法,Spring会自动注入Bean。

根据需要修改命名,即可

附:
1.在Spring中
@Component("officeInfo")
@Service
public class OfficeInfoBizImpl
2. 在代码中
public void setOfficeInfo(OfficeInfo officeInfo) {
    this.officeInfo = officeInfo;
}