class path resource [applicationContext.xml] cannot be opened because it does not exist

原文链接:https://blog.csdn.net/sinat_38301574/article/details/80465693

常见原因有二:1.web.xml配置不正确。   2:build project工程后没有将资源文件resources下的配置文件拷贝到out目录下面的classes目录下。

解决原因2的步骤如下:

1)首先我的目录为src/main/目录如下图: (spring的配置文件放在了:资源文件夹resources下spring文件夹下)

 

2)我的web.xml配置如下图:

 

 

3)打开File->Project Structure,按如下操作进行设置:、

    选择Modules-》SSM-》Dependencies-》点击+号-》点击JARS or directories-》在弹出的对话框中选到自己工程下面的resources文件夹,点击OK-》弹出的对话框中选择Classes,点击OK-》这时在Project Structure页面中的Dependencies中即可看到我们添加的resources文件夹,点击OK。

 class path resource [applicationContext.xml] cannot be opened because it does not existclass path resource [applicationContext.xml] cannot be opened because it does not existclass path resource [applicationContext.xml] cannot be opened because it does not existclass path resource [applicationContext.xml] cannot be opened because it does not exist

 

 

 

 

 

 

 

 

     再次打开File->Project Structure:

选择Artifacts即可在9那里看到刚刚添加的resources文件夹,且10那里classes文件夹下并没有resources文件夹   -》双击9位置的resources文件夹,随后可以见到11位置处出现了resources文件夹,然后点击apply,ok即可。

 class path resource [applicationContext.xml] cannot be opened because it does not existclass path resource [applicationContext.xml] cannot be opened because it does not exist

 

 

 


最后回到idea界面中,在菜单栏bulid中选择rebulid project即可在out目录.....下的classes目录看到resources文件夹下的配置文件。

 

最后,run..........即可成功运行!!

class path resource [applicationContext.xml] cannot be opened because it does not exist

上一篇:model.apply(weights_init_normal)


下一篇:python模拟点击手机上的图片按钮