新建springmvc 项目,找不到application配置文件

我新建springmvc 项目demo,报错:

org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [springmvcconfig.xml]; nested exception is java.io.FileNotFoundException: class path resource [springmvcconfig.xml] cannot be opened because it does not exist

但是,springmvcconfig.xml文件在我的src文件夹下面:
image.png

image.png

jdk是1.8
spring 是5.2.7
tomcat 是8.5

阅读 3.9k
2 个回答

建议你先确认一下class path resource的位置,该方件夹应该并不是你所想像的src文件夹。
如果你的项目遵循了官方的Spring MVC的目录结构class path resource的位置应该是:src/main/resources

新手上路,请多包涵

你的是eclipse所以要放到 src/main/webapp/WEB-INF ,默认的名字是 springmvc-servlet.xml

如果是idea springmvc的配置文件就直接放到 resource目录下 ,你可以尝试一下

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题