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

一、问题描述:

mybatis-config.xml配置:

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

Junit测试遇到报错,如下图:

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

 二、解决方法:

注册mapper: 

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

<configuration>
    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"/>
            <dataSource type="POOLED">
                <property name="driver" value="com.mysql.jdbc.Driver"/>
                <property name="url" value="jdbc:mysql://localhost:3306/mybatis?useSSL=false&amp;userUnicode=true&amp;characterEncoding=UTF-8"/>
                <property name="username" value="root"/>
                <property name="password" value="123456"/>
            </dataSource>
        </environment>
    </environments>

    <mappers>
        <!--下面的resource路径是提示为注册的Mapper.xml路径-->
        <mapper resource="com/suhuiteng/Dao/UserMapper.xml" /> 
    </mappers>
</configuration>

上一篇:MOReL: Model-Based Offline Reinforcement Learning


下一篇:Terraform入门教程,示例展示管理Docker和Kubernetes资源,java技术图谱