title: How to get Spring WebContext in class annotated @controller
body: <p>In Spring MVC with annotation, we mark any POJO with @Controller. 
  In this controller we can get WebApplicationContext, using autowired property.</p>
  
  <pre><code>@Controller
  public class HomePageController {
  
  @Autowired
  ApplicationContext act;
  
      @RequestMapping("/*.html")
      public String handleBasic(){
          SimpleDomain sd = (SimpleDomain)act.getBean("sd1");
          System.out.println(sd.getFirstProp());
          return "hello";
  }
  </code></pre>
  
  <p>But in this approach we do not have servletContext handy with us. So is there way we can still use older way of getting WebApplicationContext ? i.e.</p>
  
  <pre><code>WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext)
  </code></pre>
  
  <p>How will we get servletContext here ?</p>
  
  <p>I am not facing any compulsion to use old way; so this question is just out of curiosity to check flexibility of spring. 
  Also It can be a interview question. </p>