网上搜索了一圈解决方案,都未解决我碰到的问题,好在最终对代码一字一句的斟酌,终于发现了端倪。现将他人的解决方案汇总一下:
在mapper.xml文件中,报错的resultMap
未写出其引用的resultMap
在mapper.xml文件中,将resultType
和resultMap
弄混淆
经过多次反复检查,mapper.xml里并有上述错误,最终发现出错地方在:
application.properties
中:
<!-- 错误写法,mapperLocation少了个s-->mybatis.mapperLocation=classpath:mappers/*Mapper.xml <!-- 正确写法,mapperLocations-->mybatis.mapperLocations=classpath:mappers/*Mapper.xml