title: SpringBeanAutowiringSupport vs WebApplicationContextUtils
body: <p>This is in context to a web application. My Impl class has <code>JAX-WS</code> annotations and <code>@Autowired</code> annotation is not working.
  I get null pointer exception while retrieving the Autowired objects.</p>
  
  <p>Found to solutions, both work:</p>
  
  <ol>
  <li>Extend <code>SpringBeanAutowiringSupport</code> and keep <code>@Autowired</code> annotations intact.</li>
  <li>Use <code>WebApplicationContextUtils</code> to get the <code>WebapplicationContext</code> where beans are loaded. getBean() from this context given me the required bean.</li>
  </ol>
  
  <p>Now, the documentation of <code>SpringBeanAutowiringSupport</code> class says in NOTE 
  "<strong>If there is an explicit way to access the ServletContext, prefer such a way over using this class. The WebApplicationContextUtils class allows for easy access to the Spring root web application context based on the ServletContext.</strong>"</p>
  
  <p>What does this mean? In my web application, I am not using any servlets. My web application is also not an ONLY <code>JAX-WS</code> application. It is a web application with <code>SOAP/REST webservices</code> and <code>EJBs</code> as well.</p>
  
  <p>Which method to prefer and why? Please help.</p>