Skip to content

autowiring doesn't match generics [SPR-5546] #10217

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
spring-projects-issues opened this issue Mar 5, 2009 · 2 comments
Closed

autowiring doesn't match generics [SPR-5546] #10217

spring-projects-issues opened this issue Mar 5, 2009 · 2 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: invalid An issue that we don't feel is valid

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Mar 5, 2009

Scott Battaglia opened SPR-5546 and commented

I've created my own PersonFactory class that implements ObjectFactory<Person> and its labeled with @Component. I have a controller that has a property "private ObjectFactory<Person>" with autowired=true

There is only one ObjectFactory<Person>.

During bootstrap Spring can't seem to match the two up. It complains there is more than one ObjectFactory.


Affects: 3.0 M2

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Scott Battaglia commented

Apologies. I believe the feature actually works. Misconfiguration caused the specific bean to not instantiate.

However, the error message is slightly misleading/confusing:

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.beans.factory.ObjectFactory org.openregistry.core.web.PersonController.personFactory; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.springframework.beans.factory.ObjectFactory] is defined: Unsatisfied dependency of type [interface org.springframework.beans.factory.ObjectFactory]: expected at least 1 matching bean

Probably not worth changing though.

@spring-projects-issues
Copy link
Collaborator Author

Sébastien Deleuze commented

Closing this issue as requested.

@spring-projects-issues spring-projects-issues added type: bug A general bug status: invalid An issue that we don't feel is valid in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug A general bug label Jan 12, 2019
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: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

1 participant