无效的bean:Invalid bean definition with name ‘userMapper‘ defined in file

错误描述:
Invalid bean definition with name ‘userMapper‘ defined in file
意思是文件中定义的名为“userMapper”的bean定义无效。
看报错的服务pom文件中spring-boot-starter-web版本是3.3.5

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <version>3.3.5</version>
</dependency>

但mybatis是2.2.2

<dependency>
   <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>2.2.2</version>
</dependency>

将mybatis版本改为最新的版本(3.0.3),问题就解决了

所以可能是spring boot版本与mybatis版本不兼容,不同版本的Spring Boot和MyBatis可能具有不同的特性和依赖要求,因此不兼容的两个版本有可能导致spring boot没能自动配置mybatis。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值