当前使用版本(必填,否则不予处理)

mybatisplus.version = 3.5.1 boot-starter.version = 2.6.2

该问题是如何引起的?(确定最新版也有问题再提!!!)

使用 @MapperScan(basePackages = "xx")扫描,会将 extends IService 的接口注册到 Spring 容器中 !导致会出现两个同类型的 Bean。

重现步骤(如果有就写完整)

1、实现 IService 的接口 public interface IUserService extends IService {

}

2、实现类 @Service public class UserServiceImpl extends ServiceImpl implements IUserService {

} 3、启动类 @SpringBootApplication @MapperScan(basePackages = "com.baomidou.mybatisplus.samples.pagination") public class PaginationApplication {

public static void main(String[] args) {
    ConfigurableApplicationContext run = SpringApplication.run(PaginationApplication.class, args);
    String[] beanDefinitionNames = run.getBeanFactory().getBeanDefinitionNames();
    for (String beanDefinitionName : beanDefinitionNames) {
        System.out.println(beanDefinitionName);
    }
}

}

报错信息

图片

Comment From: miemieYaho

你用mybatis也一样

Comment From: nianq

我的问题!

Comment From: sleeping-in

因为啥,我最近拆模块加了mapperscan也是这个问题,怎么解决的?

Comment From: sleeping-in

因为啥,我最近拆模块加了mapperscan也是这个问题,怎么解决的?

我的问题!

Comment From: nianq

扫描到了

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2022年12月30日 19:39 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [baomidou/mybatis-plus] 使用 @MapperScan(basePackages = "xx")扫描,会将 extends IService 的接口注册到 Spring 容器中 (Issue #4389) |

因为啥,我最近拆模块加了mapperscan也是这个问题,怎么解决的?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>