Skip to content

Unable to autowire concrete classes when java config methods return interface [SPR-11046] #15673

Closed
@spring-projects-issues

Description

@spring-projects-issues

Michael Minella opened SPR-11046 and commented

When using JavaConfig, if the user writes the config method as shown below:

@Bean
protected ItemWriter<Object> writer() {
	return new RetrySampleItemWriter();
}

and attempts to use that bean in a class configured as such:

@Autowire
private RetrySampleItemWriter<?> itemWriter;

it doesn't work with Spring 4. Instead, you get a NoSuchBeanDefinitionException stating that there are no beans qualifying for type RetrySampleItemWriter (RetrySampleItemWriter implements ItemWriter). This worked in Spring 3.2.


Affects: 4.0 RC1

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions