<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
系统启动的时候,系统自动加载org.springframework.web.context.ContextLoaderListener这个类,然后由它负责创建Spring容器即WebApplicationContext,系统会把bean放在其中,一般情况下,创建完成后,负责IOC操作,你不需要获取它,如果非要在程序中调用它,可以通过WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(servletContext);来获取这个容器。