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

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

web.xml配置的如下


contextConfigLocation
classpath:applicationContext.xml

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


contextConfigLocation
classpath*:applicationContext.xml

你可能感兴趣的:(Maven)