title: @Autowired Spring NullPointerException Null Beans after ApplicationContext Creation
body: <p>When I create my <code>ApplicationContext</code> the myBean Constructors are used successfully.
  But after creation the beans are <code>null</code> using <code>@Autowired</code> tag.</p>
  
  <p>I though <code>@Autowired</code> would replace <code>getBean()</code> somehow? Am I getting this wrong?</p>
  
  <p><strong>Why do I need to call GetBean, when I already created my Beans (during ApplicationContext startup) and also Autowired them?</strong></p>
  
  <p>Here is what I have done so far: </p>
  
  <p>Main:</p>
  
  <pre><code>@EnableAutoConfiguration
  @Configuration
  @ComponentScan("com.somePackage")
  public class Main {
      ApplicationContext ctx= new AnnotationConfigApplicationContext(AppConfig.class);
  
      SomeBean myBean = ctx.getBean(SomeBean.class);
      myBean.doSomething();//succeeds
  
      AnyOtherClass aoc = new AnyOtherClass();//Nullpointer (see AnyOtherClass.class for details)
  
  }
  </code></pre>
  
  <p>AnyOtherClass:</p>
  
  <pre><code>public class AnyOtherClass {
      @Autowired
      protected SomeBean someBean;
  
      public AnyOtherClass(){
          someBean.doSomething();//Nullpointer
      }
  </code></pre>
  
  <p>AppConfig:</p>
  
  <pre><code>@Configuration
  public class AppConfig {
      @Bean
      @Autowired
      public SomeBean BeanSomeBean() {
          return new SomeBean();
      }
  }
  </code></pre>
  
  <p>MyBean:</p>
  
  <pre><code>public class SomeBean {
      public SomeBean (){}
      public void doSomething() {
          System.out.println("do Something..");
      }
  }
  </code></pre>
  
  <p>Note: Interface <code>ApplicationContextAware</code> works fine but without <code>@Autowired</code>. And I would really like to go with <code>@Autowired</code> since it sounds more comfortable and less errorprone to me.</p>