Optimize cache used in AutowiredAnnotationBeanPostProcessor #28293
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
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 frompostProcessProperties
andpostProcessMergedBeanDefinition
, both fromdoCreateBean
. 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.The text was updated successfully, but these errors were encountered: