java.io.FileNotFoundException: class path resource cannot be opened because it does not exist.

IDEA+SSM项目构建

问题描述

  • 1、部署的时候报错找不到classpath下面的spring/applicationContext.xml文件。
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring/applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring/applicationContext.xml] cannot be opened because it does not exist
	
  • 2、查看项目目录发现spring/applicationContext.xml文件确实是在classpath下。
    项目目录结构
  • 3、最后发现是因为resources文件夹没有设置为资源文件夹的问题,所以项目创建的时候一定要注意细节!!!!!

解决办法

点击File→Project Structure将resources设置为资源文件夹重新部署即可。
在这里插入图片描述

发布了35 篇原创文章 · 获赞 13 · 访问量 8543
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章