0
点赞
收藏
分享

微信扫一扫

【MyBatis】:Type interface com.atguigu.mybatis.mapper.UserMapper is


如果你学过尚硅谷SSM视频可能出现的一个问题

昨天调代码时候出现的一个bug,希望大家能够注意下

org.apache.ibatis.binding.BindingException: Type interface com.atguigu.mybatis.mapper.UserMapper is not known to the MapperRegistry.

错误发生在这一行

【MyBatis】:Type interface com.atguigu.mybatis.mapper.UserMapper is_配置文件

你只需要将映射文件中的package name改为 mapper resource即可,因为你学到这里的时候,可能还没有学过包引入映射文件,这是通过文件引入

循序渐进,在前期是通过mapper resource引入配置文件,后面可以用包名直接引入,更简洁

<!--引入映射文件-->
    <mappers>
        <package name="mappers/UserMapper.xml"/>
    </mappers>

修改核心配置文件mybatis-config.xml成功解决

【MyBatis】:Type interface com.atguigu.mybatis.mapper.UserMapper is_mybatis_02

举报

相关推荐

0 条评论