org.apache.ibatis.binding.BindingException:Type interface is not known to the MapperRegistry.

╰半夏微凉° 2022-01-28 09:43 315阅读 0赞

org.apache.ibatis.binding.BindingException: Type interface com.dao.UserDAO is not known to the MapperRegistry.

  1. at org.apache.ibatis.binding.MapperRegistry.getMapper(MapperRegistry.java:36)
  2. at org.apache.ibatis.session.Configuration.getMapper(Configuration.java:536)
  3. at org.apache.ibatis.session.defaults.DefaultSqlSession.getMapper(DefaultSqlSession.java:215)
  4. at com.util.MybatisUtil.getMapper(MybatisUtil.java:30)
  5. at com.service.impl.UserServiceImpl.login(UserServiceImpl.java:18)
  6. at com.test.TestService.testLogin(TestService.java:18)
  7. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  8. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  9. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  10. at java.lang.reflect.Method.invoke(Method.java:498)

出现这个错误的主要原因是由于mapper映射文件的namespace和接口的名字不一致
如图所示 :
在这里插入图片描述

发表评论

表情:
评论列表 (有 0 条评论,315人围观)

还没有评论,来说两句吧...

相关阅读