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

Optimize cache used in AutowiredAnnotationBeanPostProcessor #28293

Closed
philwebb opened this issue Apr 6, 2022 · 0 comments
Closed

Optimize cache used in AutowiredAnnotationBeanPostProcessor #28293

philwebb opened this issue Apr 6, 2022 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@philwebb
Copy link
Member

philwebb commented Apr 6, 2022

Currently AutowiredAnnotationBeanPostProcessor has a few caches that aren't providing that much in a typical application. They're also no cleared once a context has been refreshed.

Specifically:

  • candidateConstructorCache is not hit in a typical Spring Boot application and seems unnecessary if there's only a single constructor.
  • injectionMetadataCache is typically hit twice for singletons and always once after the other. The calls come from postProcessProperties and postProcessMergedBeanDefinition, both from doCreateBean. We could perhaps get away with a single element cache (at least for singletons).
  • @Lookup support happens for each class and also uses a cache. It's not a particularly common pattern anymore and it would be nice if it could be skipped if we know it's not in use. Perhaps we can skip it for auto-configuration classes.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 6, 2022
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Apr 25, 2022
@jhoeller jhoeller added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 25, 2023
@jhoeller jhoeller self-assigned this Nov 25, 2023
@jhoeller jhoeller added this to the 6.1.x milestone Nov 25, 2023
@jhoeller jhoeller modified the milestones: 6.1.x, 6.1.2 Dec 9, 2023
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) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants