Affects: \ <5.3.23>

@Component
public class A {
    @Autowired
    private B<A> genericObject;
}

@Component
public class B<T> {
    @Autowired
    public B(T someGenericObject) { // should autowire A

    }
}

Why can't Spring solve the problem in the code? Taking the generic type of a constructor argument is very easy. Find an object by this type in the Spring container too. I don't think it will be difficult to autowire it into a constructor either. But Spring throws an error: NoUniqueBeanDefinitionException

Comment From: snicoll

There's no link between T on B being resolvable to A. Looking at the code above, you're asking to autowire a bean of type T where T is not formally defined. The type should be resolved in the type signature in one way or the other for the container to be able to see it.

If you have more questions, please follow-up on StackOverflow, as mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements.