报错信息:

Exception in thread "main" org.apache.ibatis.binding.BindingException: Type interface com.web.mybatis.i.PersonMapper 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:750)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.getMapper(DefaultSqlSession.java:292)
    at com.web.mybatis.test.Test.oneToOneTest(Test.java:14)
    at com.web.mybatis.test.Test.main(Test.java:24)

原因:使用MyBatis框架访问数据库时,与Mapper文件对应的接口和mapper文件的文件路径不相同

将mapper文件和接口文件放到同一包下

MyBatis—— org.apache.ibatis.binding.BindingException: Type interface com.web.mybatis.i.PersonMapper is not known to the MapperRegistry.

 

相关文章:

  • 2022-12-23
  • 2021-08-03
  • 2021-04-08
  • 2021-12-18
  • 2021-09-10
  • 2021-08-06
  • 2021-07-20
  • 2021-09-17
猜你喜欢
  • 2021-05-28
  • 2022-12-23
  • 2021-09-22
  • 2021-04-15
  • 2021-12-17
  • 2021-04-25
  • 2022-12-23
相关资源
相似解决方案