I\'m setting up mybatis using annotations, and getting this helpful exception
org.apache.ibatis.binding.BindingException: Type interface org.foo.Bar is
It may be that your mapper.xml file is using the incorrect namespace (perhaps because of a copy paste error).
For instance, let's say you have a Java interface called MyEntityMapper.java
that should be linked to a mybatis mapper xml config called MyEntityMapper.xml
:
MyEntityMapper.java
package my.mappers;
public interface MyEntityMapper {
MyEntity getById(@Param("id") String id);
}
MyEntityMapper.xml
Notice that the namespace
attribute on the
element in MyEntityMapper.xml
is pointing to some non-existent mapper non.existent.package.NonExistentMapper
, when really it should be pointing to my.mappers.MyEntityMapper
.