InjectionMetadata.EMPTY won't cached well in AutowiredAnnotationBeanPostProcessor#injectionMetadataCache
org.springframework.beans.factory.annotation.InjectionMetadata#needsRefresh with InjectionMetadata.EMPTY always returns true,
And therefore AutowiredAnnotationBeanPostProcessor#find always calls AutowiredAnnotationBeanPostProcessor#buildAutowiringMetadata
As a result of this, Performance degration of constructing component happen from 5.1.
Ref: https://github.com/spring-projects/spring-framework/issues/23905
This is a part of performance degration, And this pull request won't improve performance degration completely. performance degration remains a little.
Comment From: jhoeller
Good catch! I've implemented this slightly differently, introducing a needsRefresh method on InjectionMetadata itself (which is overridden to always return false in the EMPTY instance). Thanks for the pull request, in any case!
Comment From: yokotaso
@jhoeller Thank you! code might be broken? https://github.com/spring-projects/spring-framework/commit/669a689a50a1afd8f3cd97639753933822c8c79e#diff-59a9bf0a4cc5269a25aa9aba094bd2e7R2
Comment From: jhoeller
Indeed, fixing that comment typo as we speak :-) (and refining some javadoc a bit)