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

简介: 【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.


错误发生在这一行


3e3a0294e1774ec4b87923f0ff1b32b9.png


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


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


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

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

c7262bff14f44f518792fe6c9e271a79.png


相关文章
|
3月前
|
SQL Java 数据库连接
MyBatis的配置文件中定义类型别名(type aliases)的技巧。
类型别名提供了一种便捷的方式来引用复杂的全限定类名。通过使用 `<package>`标签进行自动扫描或使用 `<typeAlias>`标签手动指定,可以在整个MyBatis配置中提高清晰度和维护性。无论是简化mapper文件中的配置,还是提高整体的配置可读性,类型别名都是一个非常有用的配置工具。
179 0
|
Java 数据库连接 mybatis
mybatis报错:Type handler was null on parameter mapping or property ‘__frch_xxx_0’
mybatis报错:Type handler was null on parameter mapping or property ‘__frch_xxx_0’
2475 0
mybatis报错:Type handler was null on parameter mapping or property ‘__frch_xxx_0’
|
Java 数据库连接 mybatis
flowable项目启动项目报错:Consider defining a bean of type ‘org.mybatis.spring.SqlSessionTemplate‘ in ……
flowable项目启动项目报错:Consider defining a bean of type ‘org.mybatis.spring.SqlSessionTemplate‘ in ……
568 0
|
Java 数据库连接 Maven
Could not autowire. No beans of ‘ArticleMapper‘ type found. 要添加Mybatis的依赖
Could not autowire. No beans of ‘ArticleMapper‘ type found. 要添加Mybatis的依赖
|
XML Java 数据库连接
Eclipse MyBatis1.4.2 generatorConfig 默认不生成XML文件,加了type="XMLMAPPER"也不起作用,解决方法
今天下载了最新的mybatis插件,生成不了XML文件,然后是一堆java注解文件,还有一堆报错。心头各种不爽,网上搜了很久,都是很旧的帖子,根据解决不了问题。最后自己在官网找到了答案,以后大家在搜索找不到答案,还是自己到官网翻文档吧! MyBatis 的官网generatorConfig说明如下: http://mybatis.org/generator/configreference/xmlconfig.html
1306 0
Eclipse MyBatis1.4.2 generatorConfig 默认不生成XML文件,加了type="XMLMAPPER"也不起作用,解决方法
|
XML SQL Java
解决Mybatis报错问题:Type interface com.tjcu.dao.UserDao is not known to the MapperRegistry.
解决Mybatis报错问题:Type interface com.tjcu.dao.UserDao is not known to the MapperRegistry.
245 0
解决Mybatis报错问题:Type interface com.tjcu.dao.UserDao is not known to the MapperRegistry.
|
JSON Java 数据库连接
IDEA在写Mybatis时遇到了Could not autowire. No beans of 'xxxx' type found 的错误提示
IDEA在写Mybatis时遇到了Could not autowire. No beans of 'xxxx' type found 的错误提示
410 0
|
Java 数据库连接 mybatis
mybatis报错Type interface xxx.Dao is not known to the MapperRegistry
mybatis报错Type interface xxx.Dao is not known to the MapperRegistry
|
XML SQL Java
解决Mybatis报错问题:Type interface com.tjcu.dao.UserDao is not known to the MapperRegistry.
解决Mybatis报错问题:Type interface com.tjcu.dao.UserDao is not known to the MapperRegistry.
解决Mybatis报错问题:Type interface com.tjcu.dao.UserDao is not known to the MapperRegistry.
|
Java 数据库连接 mybatis
MyBatis - Could not resolve type alias ‘XXX‘(实体类全局别名)
MyBatis - Could not resolve type alias ‘XXX‘(实体类全局别名)
452 0