1.
ApplicationContext ac = newClassPathXmlApplicationContext("spring-servlet.xml");
2.
ServletContext servletContext=request.getSession().getServletContext();
ApplicationContext ac=WebApplicationContextUtils.getWebApplicationContext(servletContext);
3.
WebApplicationContext ac=ContextLoader.getCurrentWebApplicationContext();