使用Mybatis报错“Type interface com.test.mapper.UserMapper is not known to the MapperRegistry.“

青旅半醒 2023-09-29 22:58 97阅读 0赞
  1. UserMapper mapper = MybatisUtil.getSqlSession().getMapper(UserMapper.class);
  2. System.out.println(mapper);

使用Mybatis报错“Type interface com.test.mapper.UserMapper is not known to the MapperRegistry.“

  1. <mapper resource="com/yh/dao/UserMapper.xml"/>

要保证mapper.xml
和接口UserMapper的类全路径名,保持一致。

发表评论

表情:
评论列表 (有 0 条评论,97人围观)

还没有评论,来说两句吧...

相关阅读