Maven项目:cannot be opened because it does not exist

Maven多模块中的异常 BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

Idea中错误提示Caused by: java.io.FileNotFoundException: class path resource [application-context.xml] cannot be opened because it does not exist

一启动服务器,错误提示Caused by: java.io.FileNotFoundException: class path resource [application-context.xml] cannot be opened because it does not exist

解决方法

错误提示,很明显编译器没有找到:application-context.xml —>>>
1.查看web.xml文件中编写的application-context.xml对应的路径下是否有该文件,或者是名字没有错误。
2.application-context.xml是否在Source root或Resources root路径下。(问题就出在这)

在IDEA中将文件夹设置为source root

如下图:
在文件夹上右击——>Mark Directory as——>Sources Root(Resource Root在编译后同Source一样放置在classes下)
Maven项目:cannot be opened because it does not exist