mybatis——plus的mapper注入失败

在使用MyBatis-Plus时遇到了Mapper注入失败的问题,具体表现为Spring Boot启动时抛出UnsatisfiedDependencyException,原因是在依赖注入UcenterMemberMapper时,无法找到符合条件的bean。错误堆栈中显示NoSuchBeanDefinitionException,提示没有找到UcenterMemberMapper类型的autowire候选bean。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

当注解

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
遇上application.properties时
# mysql数据库连接
spring.datasource.url=jdbc:mysql://localhost:3306/MoneyProject?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT&allowPublicKeyRetrieval=true
spring.datasource.username=root
spring.datasource.password=123
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.max-idle=10
spring.datasource.max-wait=10000
spring.datasource.min-idle=5
spring.datasource.initial-size=5

就会报错org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘ucenterMemberServiceImpl’: Unsatisfied dependency expressed through field ‘baseMapper’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.yxy.service_ucenter.mapper.UcenterMemberMapper’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.yxy.service_ucenter.mapper.UcenterMemberMapper’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值