之前配springMVC时(之前配置springMVC的手册:https://blog.youkuaiyun.com/h996666/article/details/78053603),遇到一个bug,
applicationContext.xml只能放在WEB-INF文件夹下。
导致这个问题的原因是:ContextLoaderListener默认去WEB-INF下加载applicationContext.xml配置。
可以根据以下配置来修改配置文件位置:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 修改配置文件路径 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/applicationContext.xml</param-value>
</context-param>
或者使用其它监听器(要么不使用监听器)。对于监听器我也没有深入了解。就不误人了。