org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig Error while adding the mapper ‘interface com.binhai.user.dao.UserBeanDao’ to configuration.
背景:在Spring+Mybatis+Mysql学习过程中遇到的小错误
报错原因很简单,未把resultType 改成resultMap,但在网上未找到正确解决方法,记录一下。
resultType就是简单地返回类型如String,List类型
resultMap可以实现将查询结果映射为复杂类型的pojo
两种方法都可以用,显然第二种好一些。
如下图两种方法对照
第二种方法resultMap对应的是id的属性名
最后,没什么说的,祝大家学业有成!