Java Hibernate项目的root-context.xml文件应该位于何处



我有一个新安装的eclipse版本:版本:2020-09(4.17.0(我正在尝试构建一个springweb应用程序并将其部署到Tomcat7。当我进行maven安装时,我得到了以下错误:

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

我在src/main/webapp/WEB-INF/spring中添加了root-context.xml到我的构建路径中。我不知道我是否需要把它移到别的地方。

尝试将root-context.xml移动到src/main/resources目录,它将包含在eclipse目标文件夹中并正确运行。

如果你在测试路径中有测试添加,请在youtpom.xml上添加这篇文章

<build>
....
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
....
</build>

最新更新