`
AnonymMan
  • 浏览: 22696 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Type interface XXXMapper is not known to the MapperRegistry.的解决办法。

 
阅读更多

最近一直用SpringMvc+Mybabis做项目,见同事一直报Type interface XXXMapper is not known to the MapperRegistry.这个错误,google了半天,网上的说法都是说Mapper xml中的namespace对应的实体类的路径不对,查看了半天一直找不到错误,debug了半天后来终于发现了问题,问题所在就是:我的项目依赖的有两个jar包,获取sqlSession的方式都是
InputStream inputStream = Resources.getResourceAsStream(config);

SqlSessionFactorysqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);

getResourceAsStream中是MapperConfig的文件名,依赖的两个jar包各自有一个MapperConfig.xml,该文件中引入的xxxxmapper.xml不同,导致调用的时候只加载了一个MapperConfig.xml中的mapper.xml,对应的mapper没有注册到mybatis的MapperRegistry中所以会一直报Type interface XXXMapper is not known to the MapperRegistry.特此收录一把,仅供参考。

 

 

转载前请指明本文地址:http://anonymman.iteye.com/blog/2138316

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics