@Autowired bean property is null in @Configuration bean
<p>I have a problem with @Autowired property in @Configuration bean.</p>

<p>I have a bean similar to the one below:</p>

<pre><code>@Configuration
public class MyConfig {
    @Autowired MongoTemplate mongoTemplate;

    @Bean
    MongoDbMetadataStore indexMetadataStore() {
        return new MongoDbMetadataStore(mongoTemplate, "index");
    }
}
</code></pre>

<p>and ... mongoTemplate is null while creating indexMetadataStore bean (checked with debugger). Unfortunately I cannot provide entire project structure, it is large (it has ~5 XML config files and around 20-30 @Configuration beans) and my bet is that there could a circular reference or something of sort.</p>

<p>However, this mongoTemplate bean is created earlier and injected to other beans (also checked with debugger), so at this point mongoTemplate is fully created and I cannot understand why it is not injected and left null.</p>

<p>Any ideas where I should look?</p>