maven创建web工程Spring配置文件找不到

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

contextConfigLocation
classpath:applicationContext.xml

用google搜索一下(之前google用不了,用百度搜到蛋疼),发现是由于classpath不是指向resource路径,导致一直找不到文件。需要在classpath后面加个,这样就解决问题了。

contextConfigLocation
classpath
:applicationContext.xml

posted @ 2017-10-23 15:27  comeluder  阅读(507)  评论(0编辑  收藏  举报