title: Cannot @Autowire a @Bean property
body: <p>I have a DAO class which is annotated with <code>@Configuration</code>. In this DAO class I have a bean defined as</p>
  
  <pre><code>@Bean
  public MyDao myDao(){
      return new MyDao(dataSource);
  }
  </code></pre>
  
  <p>Now I want to use this DAO in my service class. So I annotated the service class with <code>@Service</code> and used</p>
  
  <pre><code>@Autowired private IMyDao myDao;
  </code></pre>
  
  <p>While running the tests I get the below error</p>
  
  <pre><code>org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [IMyDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  </code></pre>