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

[DSIP-28] Donot scan whole project beans under classpath #15877

Closed
3 tasks done
Tracked by #14102
ruanwenjun opened this issue Apr 18, 2024 · 0 comments · Fixed by #15874
Closed
3 tasks done
Tracked by #14102

[DSIP-28] Donot scan whole project beans under classpath #15877

ruanwenjun opened this issue Apr 18, 2024 · 0 comments · Fixed by #15874
Assignees
Labels

Comments

@ruanwenjun
Copy link
Member

ruanwenjun commented Apr 18, 2024

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Motivation

Right now we will scan all beans under org.apache.dolphinscheduler in
AlertServer

@ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = JdbcRegistryAutoConfiguration.class)
})
public class AlertServer {

ApiServer

@ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = JdbcRegistryAutoConfiguration.class)
})
@Slf4j
public class ApiApplicationServer {

MasterServer

@ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = JdbcRegistryAutoConfiguration.class)
})
@EnableTransactionManagement
@EnableCaching
@Slf4j
public class MasterServer implements IStoppable {

WorkerServer.

@ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = JdbcRegistryAutoConfiguration.class)
})
@Slf4j
public class WorkerServer implements IStoppable {

This will allow us to know the module relation difficultly, furthermore, if there exists an unexpected module in the application, the beans in this module will be loaded into memory, e.g. worker load dao module.

So it's better avoid scan whole project.

Design Detail

First, the application should only scan the package of the bootstrap class. Other package beans should be import by Configuration.

Second, the plugin beans should be registered by AutoConfiguration.

Compatibility, Deprecation, and Migration Plan

Compatibility with 3.x version.

Test Plan

Test by UT and E2E

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@ruanwenjun ruanwenjun self-assigned this Apr 18, 2024
@ruanwenjun ruanwenjun changed the title [DSIP] Donot scan whole project beans under classpath [DSIP-28] Donot scan whole project beans under classpath Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant