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

Prevent unnecessary refresh for InjectionMetadata.EMPTY #24485

Closed
wants to merge 1 commit into from

Conversation

yokotaso
Copy link
Contributor

@yokotaso yokotaso commented Feb 6, 2020

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: #23905

This is a part of performance degration, And this pull request won't improve performance degration
completely. performance degration remains a little.

…ostProcessor#injectionMetadataCache

org.springframework.beans.factory.annotation.InjectionMetadata#needsRefresh
with InjectionMetadata.EMPTY always returns false,

And therefore AutowiredAnnotationBeanPostProcessor#find always calls
AutowiredAnnotationBeanPostProcessor#buildAutowiringMetadata

As a result of this, Performance of constructing component degration
happen from 5.1.

Ref: spring-projects#23905
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 6, 2020
@jhoeller jhoeller changed the title Issue-23905 Fix performance degration Prevent unnecessary refresh for InjectionMetadata.EMPTY Feb 6, 2020
@jhoeller jhoeller self-assigned this Feb 6, 2020
@jhoeller jhoeller added in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 6, 2020
@jhoeller jhoeller added this to the 5.2.4 milestone Feb 6, 2020
@jhoeller
Copy link
Contributor

jhoeller commented Feb 6, 2020

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!

@yokotaso
Copy link
Contributor Author

yokotaso commented Feb 6, 2020

@jhoeller
Thank you! code might be broken?
669a689#diff-59a9bf0a4cc5269a25aa9aba094bd2e7R2

@jhoeller
Copy link
Contributor

jhoeller commented Feb 6, 2020

Indeed, fixing that comment typo as we speak :-) (and refining some javadoc a bit)

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: regression A bug that is also a regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants