title: Why Spring @Autowired ApplicationContext appContext is null?
body: <p>I have Spring bean with annotations:</p>
  
  <pre><code>@Named
  @Scope("session")
  </code></pre>
  
  <p>And this bean property:</p>
  
  <pre><code>@Autowired
  ApplicationContext appContext;
  </code></pre>
  
  <p>The Spring configuration file has entry (that works for other anotations/injections):</p>
  
  <pre><code>&lt;context:component-scan base-package="my.package.name" /&gt;
  </code></pre>
  
  <p>Why appContext is null after such code and configuration?</p>
  
  <p>I am trying to get ApplicationContext (to call getBean(...) on it) and this can be quite involved task (judging from other discussions) in previous Spring versions (e.g. one is required to get ServletContext in Spring web application to create ApplicationContext and getting ServletContext can be quite involved task for beans that don't directly access HTTP Request objects). In Spring 3.x, as I understand, simple @Autwired injection can be used. How AppContext can be accessed?</p>