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

小鱼儿 2022-06-14 05:56 295阅读 0赞

maven创建web工程Spring配置文件找不到问题解决方案

使用maven创建web工程,将spring配置文件applicationContext.xml放在src/resource下,编译时提示class path resource [applicationContext.xml] cannot be opened because it does not exist错误。但是用mvn clean package命令编译时成功的。

web配置文件


contextConfigLocation
classpath:applicationContext.xml


org.springframework.web.context.ContextLoaderListener

发现是由于classpath不是指向resource路径,导致一直找不到文件。需要在classpath后面加个*,这样就解决问题了。

contextConfigLocation

classpath*:applicationContext.xml

发表评论

表情:
评论列表 (有 0 条评论,295人围观)

还没有评论,来说两句吧...

相关阅读