Skip to content

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

Closed

Description

@spring-projects-issues

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:

Activity

  1. spring-projects-issues commented on Mar 5, 2009

    @spring-projects-issues
    CollaboratorAuthor

    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.

  2. spring-projects-issues commented on Nov 4, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Sébastien Deleuze commented

    Closing this issue as requested.

  3. added
    type: bug
    status: invalid
    in: core
    and removed
    type: bug
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: corestatus: invalid

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions