1、检查 mapper.xml 中 namespace 等于是否与mapper接口地址一致
mapper.xml:
select * from order where code = #{code}
2、检查mapper.java 接口中的方法名和 mapper.xml 中的statement 的 id 是否保持一致。
3、mapper接口中的方法返回值是List,而select元素没有正确配置ResultMap,或者只配置ResultType
4、检查application.properties配置文件是否添加以下配置信息(我就是因为这个原因导致报错的,添加之后问题解决):
mybatis.mapperLocations=classpath:mapper/*Mapper.xml
mybatis.typeAliasesPackage=com.gugr.springboot.entity
原文链接:https://blog.csdn.net/sinat_38232376/article/details/81915605
我检查了各项配置发现没有问题,重启idea后好了!!!