使用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

相关文章:

  • 2021-07-03
  • 2021-07-13
  • 2021-07-04
  • 2021-05-18
  • 2022-01-01
  • 2021-10-12
  • 2022-12-23
  • 2021-07-13
猜你喜欢
  • 2021-12-02
  • 2021-12-21
  • 2021-07-08
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
相关资源
相似解决方案