解决org.apache.ibatis.binding.BindingException: Type interface XXX is not known to the MapperRegistry.

版权声明:原创文章,转载请说明出处 https://blog.csdn.net/Destiny_strive/article/details/82702985

org.apache.ibatis.binding.BindingException: Type interface com.byh.mapper.OrderMapper is not known to the MapperRegistry.

    at org.apache.ibatis.binding.MapperRegistry.getMapper(MapperRegistry.java:47)
    at org.apache.ibatis.session.Configuration.getMapper(Configuration.java:675)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.getMapper(DefaultSqlSession.java:250)
    at Demo2.bef(Demo2.java:37)
    ......

在做mybatis的例子中遇到这个错误。

检查了好一会后,发现错误是:

1、xml文件的namespace的值对应的mapper接口写错了。

2、xml文件没有被添加到mybatis的配置文件中扫描。

猜你喜欢

转载自blog.csdn.net/Destiny_strive/article/details/82702985