Skip to content

Optimize constructor dependency injection performance for parameter name matches #28122

Closed
@alaneuler

Description

@alaneuler

If initializing bean via constructor dependency injection, Spring will do the candidates look-up by parameter type (essentially via BeanFactoryUtils#beanNamesForTypeIncludingAncestors) which is really slow if application getting huge. We are searching an approach to tell Spring to look-up candidates by constructor's parameter name.

I've read the code in ConstructorResolver but cannot find a way to achieve constructor dependency injection by parameter name. By the way there is a similar question on Stack Overflow: Spring autowire by name constructor arguments, there is just a work-around but not solution.

Can Spring support this feature if parameter name is available in runtime?

Affects: <All Spring Framework versions>

Metadata

Metadata

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions