【问题标题】:Unable to access XML file in spring春季无法访问 XML 文件
【发布时间】:2019-02-09 21:36:01
【问题描述】:

我正在使用 spring 并且无法读取 Spring.xml 文件。 ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml"); 向我显示此错误: 原因:java.io.FileNotFoundException:类路径资源[Spring.xml]无法打开,因为它不存在

xml pathemphasized text

【问题讨论】:

  • 这个问题需要稍微清理一下。我不确定图像链接的全部内容,但最好在问题正文中提供代码和其他文本信息作为实际文本。此外,养成将代码等格式设置为code 的习惯。如果你edit这个问题你可以自己改进这个问题。这将帮助您吸引愿意回答您问题的人的更多兴趣。

标签: xml spring spring-framework-beans


【解决方案1】:

我建议使用 Maven 生成一个新项目。回答你的问题重构你的项目,如下所示,它将能够在类路径中找到 xml

src/main/java - 你的所有课程

src/main/resources - 你的所有配置、属性、xml 等

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-04-06
    • 1970-01-01
    • 2016-01-21
    • 2014-03-18
    • 1970-01-01
    • 2014-01-30
    • 1970-01-01
    • 2020-02-04
    相关资源
    最近更新 更多