在web.xml中通过contextConfigLocation配置spring,
contextConfigLocation参数定义了要装入的 Spring 配置文件。默认会去/WEB-INF/下加载applicationContext.xml。
如果想装入多个配置文件,可以在 <param-value>
标记中用逗号作分隔符或通配符。
在web.xml里配置Listener
web.xml 代码如下:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/app-*.xml</param-value>
</context-param>
app-context.xml
<context:component-scan base-package="com.xdt.ibs" />