问题描述:
MapperRegistry不知道 com.mycode.dao.UserMapper这个接口。
Mybatis报错:Type interface com.mycode.dao.UserMapper is not known to the MapperRegistry.
解决思路:
Mybatis报错:Type interface com.mycode.dao.UserMapper is not known to the MapperRegistry.
以上图示代码首先是读取核心配置文件(SqlMapConfig.xml),得到一个输入流,构造者根据输入流流构造一个工厂,工厂生产一个SqlSession对象,SqlSession对象得到映射器的代理对象(有接口,没有实现类,生成代理对象),由代理对象执行sql语句。而报错是MapperRegistry不知道 com.mycode.dao.UserMapper这个接口,所有先看一下映射配置文件(UserMapper.xml)中namespace属性,namespace属性是规定给那个接口配置的映射。
Mybatis报错:Type interface com.mycode.dao.UserMapper is not known to the MapperRegistry.
这是就发现了问题。。。。写习惯了Dao,这里的接口名写错了

相关文章:

  • 2021-08-03
  • 2021-05-28
  • 2021-04-08
  • 2021-12-18
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
  • 2021-09-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2021-04-15
  • 2021-12-17
  • 2022-12-23
相关资源
相似解决方案