Skip to content

DefaultListableBeanFactory#getBeanNamesForType does not take target type into account for FactoryBean resolution #30987

@snicoll

Description

@snicoll

Given a RootBeanDefinition for a FactoryBean that exposes a generic for the bean that it produces (typically Spring Data repositories infrastructure):

RootBeanDefinition beanDefinition = new RootBeanDefinition(JpaRepositoryFactoryBean.class);
beanDefinition.setTargetType(ResolvableType.forClassWithGenerics(JpaRepositoryFactoryBean.class,
		CityRepository.class, Object.class, Object.class));

A call to getBeanNamesForType with CityRepository.class does not return the bean definition. It looks like the target type is not taken into account to resolve the FactoryBean's generic type, if available.

Failing test case at: snicoll@edb8a05

Metadata

Metadata

Labels

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

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions