Skip to content

Prevent unnecessary refresh for InjectionMetadata.EMPTY#24485

Closed
yokotaso wants to merge 1 commit into
spring-projects:masterfrom
yokotaso:Issue-23905
Closed

Prevent unnecessary refresh for InjectionMetadata.EMPTY#24485
yokotaso wants to merge 1 commit into
spring-projects:masterfrom
yokotaso:Issue-23905

Conversation

@yokotaso

@yokotaso yokotaso commented Feb 6, 2020

Copy link
Copy Markdown
Contributor

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

jhoeller commented Feb 6, 2020

Copy link
Copy Markdown
Contributor

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

yokotaso commented Feb 6, 2020

Copy link
Copy Markdown
Contributor Author

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

@jhoeller

jhoeller commented Feb 6, 2020

Copy link
Copy Markdown
Contributor

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