Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我想问一下 各个模块加载自己的上下文的时候,为什么会出现重复加载某个类的情况 #1329

Open
xycf2233 opened this issue Jun 20, 2024 · 3 comments

Comments

@xycf2233
Copy link

xycf2233 commented Jun 20, 2024

如题。在各个模块加载自己上下文时控制台会大量打印“Component was already registered:xxxx”。
重复的扫描让项目启动时间变得很长。二三十分钟启动真的很难以接受。

@CrazyHZM
Copy link
Contributor

检查一下是不是配置的ComponentScan里的扫描路径有重叠

@xycf2233
Copy link
Author

没有重叠,出现问题的是当前项目下的common-dal中的mapper类。通过MapperScan指定了扫描路径,但是在SpringContextInstallStage类的doRefreshSpringContext方法中,多线程去刷新各个模块上下文(ctx.refresh())的时候,应该是每个线程都重复去扫描了

@HzjNeverStop
Copy link
Contributor

@xycf2233 你好,可以给出一个示例代码来复现这个问题吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants