在搭建SpringMVC框架的時候遇到了這個問題
問題的原因: 就是沒有找到applicatoincontext.xml這個文件, 因為idea自動生成的路徑不正確
因此需要再web.xml里面, (對contextConfigLocation這個變量的)
將application.context.xml這個文件的路徑進行修改,
將
/config/spring/applicationContext.xml
修改為
classpath:config/spring/applicationContext.xml
web.xml中原來的代碼:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/config/spring/applicationContext.xml</param-value>
</context-param>
web.xml中修改后的代碼:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:config/spring/applicationContext.xml</param-value>
</context-param>
修改之后, 問題解決!