Skip to content

Use method meta-data in getTypeForFactoryMethod #821

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

Closed
wants to merge 1 commit into from

Conversation

philwebb
Copy link
Member

Update AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod to
use already loaded method meta-data when deducing the type of a factory
method.

Update AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod to
use already loaded method meta-data when deducing the type of a factory
method.

Issue: SPR-13144
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 24, 2019
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Nov 11, 2021
@rstoyanchev rstoyanchev added this to the 6.0.x milestone Nov 23, 2021
@rstoyanchev rstoyanchev added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 23, 2021
@jhoeller jhoeller modified the milestones: 6.0.x, 6.1.x Feb 14, 2023
@jhoeller jhoeller modified the milestones: 6.1.x, 6.x Backlog Jun 6, 2023
@jhoeller
Copy link
Contributor

jhoeller commented Aug 3, 2023

In the meantime, the cached factory method return type is a ResolvableType which takes a generic method signature into account. It seems generally sensible to immediately resolve the Method handle there (rather than inferring the declared return type from the ASM metadata) since the actual Method is subsequently introspected for other purposes as well. Resolving the ASM-declared type name first (which involves a ClassLoader call) and then the full Method handle shortly thereafter (which comes with the resolved return type Class as well as a potential generic declaration) is not likely to provide a performance benefit within the current container bootstrap arrangement anymore.

@jhoeller jhoeller closed this Aug 3, 2023
@jhoeller jhoeller removed this from the 6.x Backlog milestone Aug 3, 2023
@sbrannen sbrannen added the status: declined A suggestion or change that we don't feel we should currently apply label Aug 3, 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) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants