在web.xml中经过contextConfigLocation配置spring,contextConfigLocation 参数定义了要装入的 Spring 配置文件。
若是想装入多个配置文件,能够在<param-value>标记中用逗号做分隔符。
在web.xml里配置Listener web
若是在web.xml里给该Listener指定要加载的xml,如: spring
xml代码以下: app
<!-- spring config --> spa
<context-param> code
<param-name>contextConfigLocation</param-name> xml
<param-value>classpath:applicationContext.xml</param-value> it
</context-param> io
则会去加载相应的xml,而不会去加载/WEB-INF/下的applicationContext.xml。 class
可是,若是没有指定的话,默认会去/WEB-INF/下加载applicationContext.xml。 配置