Skip to content

Conversation

gusdn7142
Copy link

Resolves issue #1515 by replacing deprecated SpringFactoriesLoader.loadFactoryNames() with new AOT-compatible API.

Key changes:

  • Replace SpringFactoriesLoader.loadFactoryNames() with SpringFactoriesLoader.forDefaultResourceLocation().load() in ProjectGenerator#getProjectGenerationConfigurationFactoryNames()
  • Remove @SuppressWarnings("deprecation") annotation
  • Add stream mapping to maintain same return type List<String> by converting loaded instances to class names
  • Improves compatibility with AOT compilation and native image environments
  • No behavioral changes - method returns identical factory class name lists

Fixes gh-1515

Replace deprecated SpringFactoriesLoader.loadFactoryNames() with
SpringFactoriesLoader.load() to improve AOT compatibility and
remove suppressed deprecation warnings.

Fixes spring-iogh-1515

Signed-off-by: gusdn7142 <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 23, 2025
@mhalbritter
Copy link
Contributor

mhalbritter commented Aug 26, 2025

Hello,

thanks for the PR.

when looking at the usages of getProjectGenerationConfigurationFactoryNames, this could be optimized, too.

in getCandidateProjectGenerationConfigurations, Class<?> type = resolveClass(candidate); is used to instantiate the class. This could be avoided if we don't return Strings from getProjectGenerationConfigurationFactoryNames but the class directly.

@mhalbritter mhalbritter added the status: waiting-for-feedback We need additional information before we can continue label Aug 26, 2025
@mhalbritter
Copy link
Contributor

Gentle ping, @gusdn7142 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix deprecations
3 participants