Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/config/spring/applicationContext.xml]


在搭建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>

修改之后, 问题解决!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM