title: How to autowire for multilevel inheritance class in spring MVC
body: <p>In my project I have three classes which related by multilevel inheritance as bellow</p>
  
  <pre><code>@Component
  @Scope("prototype")
  class A{
  
  
  }
  
  @Component
  @Scope("prototype")
  class B extends A{
  
  }
  
  @Component
  @Scope("prototype")
  class C extends B{
  
  }   
  </code></pre>
  
  <p>Now by using @Autowired annotation I want <strong>C class</strong> Object inside the <strong>Manager class</strong></p>
  
  <pre><code>@Component(value = "manager")
  @Scope("prototype")
  class Manager {
  
  @Autowired
  A a;
  
  @Autowired
  B b;
  
  @Autowired
  C c;
  
  ......
  }
  </code></pre>
  
  <p>Here <strong>A</strong> and <strong>B</strong> class Objects are injected by spring container but while injecting Object for <strong>C</strong> it is complaining as bellow </p>
  
  <pre><code>nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.abc.bca.generator.sss.B] is defined: expected single matching bean but found 2: b,c
  </code></pre>
  
  <p>When I use @Qualifier for C class as</p>
  
  <pre><code>@Autowired
  @Qualifier('c')
  C c 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>@Autowired
  @Qualifier('c')
  B c 
  </code></pre>
  
  <p>Still it is showing same error, so how can I get Object for <strong>C</strong> class. </p>