2017-08-07 55 views
0

我遇到了iBatis的这个绑定问题。这是我的项目的结构:我想在Device.xml映射DeviceDaoiBatis与Maven的映射器绑定异常

enter image description here

。这是我在Device.xml中做到的。

<mapper namespace="service.dao.DeviceDao"> 

但是,当我尝试访问它时,会引发此错误。

"errorMessage": "Type interface service.dao.DeviceDao is not known to the MapperRegistry.","errorType": "org.apache.ibatis.binding.BindingException" 

我试着将它改为smartcontrol.service.dao.DeviceDao,但仍然没有工作。

我不明白的是,为什么Device 对象的引用位置没有引起任何问题?

,我谈到Configurations.xml被引用

<typeAliases> 
    <typeAlias alias="Device" type="server.pojo.Device"/> 
</typeAliases> 

设备位于下server.pojo

enter image description here

你看,他们service.dao.DeviceDao的设备对象和server.pojo.Device都位于samples/src/main/java/smartcontrol下。那么,为什么在引用service.dao.DeviceDao时存在问题,而server.pojo.Device没有问题?

回答

0

“的errorMessage”: “类型接口service.dao.DeviceDao是不知道的 MapperRegistry。”, “ERRORTYPE”: “org.apache.ibatis.binding.BindingException”

这意味着映射器未在主MyBatis配置文件中注册。更多信息:http://www.mybatis.org/mybatis-3/configuration.html#mappers