[Solved] BindingException: Type interface XXX is not known to the MapperRegistry

Problem description

When testing the selection operation of mybatis, the idea reports an error,

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

Solution:

Reason: each mapper.xml needs to be registered in the mybatis core configuration file
add the following code to mybatis-config.xml.

<mappers>
    <mapper resource="com/dingha/dao/UserMapper.xml"/>
</mappers>

Done!

Read More: