​​ContextLoaderListener​​可以让Spring容器随项目的启动而创建,并随项目的关闭而销毁!

<context-param>
<param-name>contextConfigLocation</param-name>
<!-- spring监听器加载的配置文件 -->
<param-value>classpath:spring/applicationContext.xml</param-value>
</context-param>
<listener>
<!--ContextLoaderListener监听器的作用就是启动Web容器时,自动装配ApplicationContext的配置信息-->
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>