spring在启动是加载的配置文件默认的名称是applicationContext.xml如果你修改了名称或者xml文件存放的位置,那么需要在web.xml中配置一下。
<!-- spring配置文件。其他的比如springMVC的配置文件也是可以这样去配置配置文件的位置 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext-*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>