报错内容:
Unsatisfied dependency expressed through field ‘personDao’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘personDao’ defined in file [C:\Users\huanshao\workspace\ch7\bin\com\dao\PersonDao.class]: Cannot resolve reference to bean ‘sqlSessionFactory’ while setting bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource
[applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/po/IdCard (wrong name: com/po/Idcard)
原因:
可能是变量名这种小错误!!比如看下图:
持久层文件
映射文件
解决办法:
将映射文件resultType值:IdCard改为Idcard