Skip to content

ImportCandidates does not use the same default class loader as SpringFactoriesLoader #44401

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

Closed
wilkinsona opened this issue Feb 22, 2025 · 3 comments
Assignees
Labels
status: invalid An issue that we don't feel is valid type: bug A general bug

Comments

@wilkinsona
Copy link
Member

Framework's SpringFactoriesLoader uses ClassUtils.getDefaultClassLoader() as its default class loader. ImportCandidates uses ImportCandidates.class.getClassLoader(). For consistency, it should use the same default as SpringFactoriesLoader.

@wilkinsona wilkinsona added the type: bug A general bug label Feb 22, 2025
@wilkinsona wilkinsona added this to the 3.3.x milestone Feb 22, 2025
@wilkinsona wilkinsona self-assigned this Feb 22, 2025
@ngocnhan-tran1996
Copy link
Contributor

May I work on this?

@wilkinsona
Copy link
Member Author

Thanks for offer, @ngocnhan-tran1996, but this issue's already assigned. I also already have the changes locally as part of a broader piece of work.

@wilkinsona
Copy link
Member Author

I was mistaken. While the ClassLoader is @Nullable and when it is null SpringFactoriesLoader will use ClassUtils.getDefaultClassLoader(), all of the static methods that can create an instance will never pass in null. Instead, they use SpringFactoriesLoader.class.getClassLoader() as the default. This change has been reverted in 21a5319.

@wilkinsona wilkinsona added the status: invalid An issue that we don't feel is valid label Feb 27, 2025
@wilkinsona wilkinsona removed this from the 3.3.10 milestone Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants