关于springboot的mapper注解扫描不到

在Springboot结合MyBatis的项目中遇到@Mapper注解无法扫描的问题,错误提示表明需要在配置中定义StudentMapper类型的bean。尝试多种解决办法无效,寻求解答。

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

一直找不到@Mapper注解,只有@Mapperscan。

解决方法:

<dependency >
<groupId > org.mybatis </groupId >
<artifactId > mybatis </artifactId >
<version > 3.4.5 </version >
</dependency >
<dependency >
<groupId > org.mybatis </groupId >
<artifactId > mybatis-spring </artifactId >
<version > 1.3.1 </version >
</dependency >
将pom.xml里面的替换成上面的


BUT我要说的不是这个问题

Description:
Field studentMapper in com.example.service.impl.StudentServiceImpl required a bean of type 'com.example.mapper.StudentMapper' that could not be found.
Action:
Consider defining a bean of type 'com.example.mapper.StudentMapper' in your configuration.
这个问题试过无数个方法不知道怎么解决,求解!!!!

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值