java - Java Hibernate 项目的文件 root-context.xml 应该放在哪里
问题描述
我有一个新安装的 eclipse 版本:版本:2020-09 (4.17.0) 我正在尝试构建 Spring Web 应用程序并将其部署到 Tomcat 7。执行 maven-install 时出现以下错误:
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 目标文件夹中并正确运行。
如果您在测试路径中有测试添加,则在您的 pom.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>
推荐阅读
- python - 安装 anaconda 后的 Anaconda3 和基础环境
- c# - C# 在使用 XMLSerializer 时从 url 读取 XML
- python - 在包含列表的 Pandas 列中查找字符串
- azure - 创建 SSL/TLS 安全通道的问题
- java - Java文件输入拆分
- php - 订购仅以天、小时、分钟保存的每周国际活动?
- javascript - 无法在 javascript 的 for 循环中求和值
- python - 张量流模型中的BatchNormalization
- c# - 将 neo4j 结果返回到 C# 对象
- python - 我需要使用 matplotlib 或 seaborn 绘制分组数据