“MapperRegistry不知道类型接口”。使用mybatis的异常 [英] "Type interface is not known to the MapperRegistry" exception using mybatis

查看:1800
本文介绍了“MapperRegistry不知道类型接口”。使用mybatis的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用注释设置mybatis,并获得此有用的异常

I'm setting up mybatis using annotations, and getting this helpful exception


org.apache.ibatis.binding.BindingException:
类型接口org.foo.Bar不是MapperRegistry已知的

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

Google搜索没有找到任何内容,也没有找到用户指南。我缺少什么?

Googling it doesn't find anything, nor the user guide. What am I missing?

推荐答案

好的,得到它 - 这是因为我使用XML文件进行配置,映射器本身的注释 - mybatis在使用XML配置时找不到映射器注释。

OK, got it - this is happening because I was using a XML file for the configuration, and annotations for the mappers themselves - and mybatis doesn't find mapper annotations when using an XML config.

请参阅后续问题

这篇关于“MapperRegistry不知道类型接口”。使用mybatis的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆