1、通过spring配置文件获取,但是需注意路径从WebContent级别写,如下:
ApplicationContext ac = new FileSystemXmlApplicationContext("/WebRoot/WEB-INF/config/common/spring/applicationContext.xml");
2、通过ServletContext获取,如下:
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(event.getServletContext());