title: How to get bean from ServletContextListener in contextDestroyed
body: <p>I want to get bean in contextDestroyed so I have this code.</p>
  
  <pre><code>public class MyContextListener implements ApplicationContextAware, ServletContextListener {
  
      private final Logger logger = LogManager.getLogger(getClass());
  
      private ApplicationContext appContext;
  
      @Override
      public void contextInitialized(ServletContextEvent event) {
          logger.warn("Start");
      }
  
      @Override
      public void contextDestroyed(ServletContextEvent event) {
          logger.warn("End" + appContext);
          appContext.getBean("myBean")
      }
  
      @Override
      public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
          this.appContext = applicationContext;
      }
  
  }
  </code></pre>
  
  <p>problem is that it log <code>null</code>. But when I change it to</p>
  
  <pre><code>    private static ApplicationContext appContext; 
  </code></pre>
  
  <p>then I can see my appContext. Why ? What is right options to get bean</p>