org.apache.ibatis.binding.BindingException: Type interface com.lzc.dao.UserDao is not known to the MapperRegistry.
Mapper没有在mybatis-config.xml中注册
问题:
-
没找到UserMapper.xml
-
没找到mybatis-config.xml
mybatis错误——java.io.IOException: Could not find resource com/xxx/xxxMapper.xml_阿飞云-CSDN博客
原因:IDEA是不会编译src的java目录的xml文件,所以在Mybatis的配置文件中找不到xml文件!(也有可能是Maven构建项目的问题,网上教程很多项目是普通的Java web项目,所以可以放到src下面也能读取到
解决方法:
在pom文件中加入: