解决org.apache.ibatis.binding.BindingException: Type interface com.mytest.dao.IUserDao is not known to the MapperRegistry.
以下是报错信息,意思是 接口类型的mapper未知,没有被注册或加载
org.apache.ibatis.binding.BindingException: Type interface com.mytest.dao.IUserDao is not known to the MapperRegistry.
at org.apache.ibatis.binding.MapperRegistry.getMapper(MapperRegistry.java:47)
at org.apache.ibatis.session.Configuration.getMapper(Configuration.java:779)
at org.apache.ibatis.session.defaults.DefaultSqlSession.getMapper(DefaultSqlSession.java:291)
at com.mytest.test.MybatisTest.testFindAll(MybatisTest.java:31)
解决方案:
在mybatis的配置文件中将该mapper的映射配置进去就行了。
<mappers>
<mapper class="com.mytest.dao.IUserDao"></mapper>
</mappers>
</configuration>