title: Get Spring ConfigurableApplicationContext runtime from a servlet
body: <p>I have the following code inside a method invoked by a jsf &lt;h:commandButton&gt;.<br>
  It gets the spring's ApplicationContext, meaning I can get a bean with this.</p>
  
  <pre><code>FacesContext fc = FacesContext.getCurrentInstance();
  ServletContext sc = (ServletContext) fc.getExternalContext().getContext();
  ApplicationContext applicationContext = org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(sc);
  </code></pre>
  
  <p><strong>My question is</strong> how to get the ConfigurableApplicationContext of the running spring instance.<br>
  I want to be able to call the .stop .start and .refresh methods.</p>
  
  <p>Alternatively, If there is any other way to call them on the running instance please inform me !</p>
  
  <p><br/><em>Note:</em> there is no main method in the application. It is a webApplication deployed on glassfish v2.1.1.</p>