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

Inconsistent default class loaders in hint classes #34470

Closed
wilkinsona opened this issue Feb 22, 2025 · 0 comments
Closed

Inconsistent default class loaders in hint classes #34470

wilkinsona opened this issue Feb 22, 2025 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Milestone

Comments

@wilkinsona
Copy link
Member

In the various hint related classes, there's a mixture of using ClassUtils.getDefaultClassLoader() and the hint class's own class loader:

ClassUtils.getDefaultClassLoader():

  • ReflectionHints
  • ObjectToObjectConverterRuntimeHints (delegates to ReflectionHints)

getClass().getClassLoader():

  • FilePatternResourceHintsRegistrar
  • ResourceHints
  • SpringFactoriesLoaderRuntimeHints

For consistency, I think the same default class loader should be used. My preference would be to use ClassUtils.getDefaultClassLoader().

In addition to the inconsistency across hints classes, it looks like SpringFactoriesLoaderRuntimeHints is inconsistent with SpringFactoriesLoader as the latter will use ClassUtils.getDefaultClassLoader().

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 22, 2025
@jhoeller jhoeller added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 23, 2025
@jhoeller jhoeller added this to the 6.2.4 milestone Feb 23, 2025
@jhoeller jhoeller added the for: backport-to-6.1.x Marks an issue as a candidate for backport to 6.1.x label Feb 23, 2025
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-6.1.x Marks an issue as a candidate for backport to 6.1.x labels Feb 23, 2025
@jhoeller jhoeller self-assigned this Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants