【问题标题】:Getting FileNotFoundException IOException errors while running Spring in IntelliJ with the help of Maven在 Maven 的帮助下在 IntelliJ 中运行 Spring 时出现 FileNotFoundException IOException 错误
【发布时间】:2020-03-24 06:43:20
【问题描述】:

我正在尝试在 Spring Framework 中运行 HelloWrld。为了找到我的 bean 定义,我正在访问一个名为 spring.xml 的文件。但是我得到了标题中提到的错误。

这是初始项目结构:

然后我将相同的文件 spring.xml 粘贴到所有目录和子目录中,希望可以选择一个(以下是截图),但是它没有用,我一直收到同样的错误。

【问题讨论】:

    标签: spring spring-boot intellij-idea filenotfoundexception ioexception


    【解决方案1】:

    另一个答案不正确。

    将您的 spring.xml 文件添加到文件夹 src/main/resources - 注意“s”。

    你可以看到我在哪里有类似的配置,我的api.yaml 文件就在那里

    【讨论】:

      【解决方案2】:

      尝试在 src/main 下创建一个“资源”文件夹。 并复制资源文件夹下的spring.xml文件 不要忘记做:将目录标记为:资源根(右键单击)

      【讨论】:

      • 别忘了做:将目录标记为:资源根目录(右键单击)
      • 我已按照您的指示进行操作,但不幸的是,它仍然无法正常工作。
      • 你在启动应用程序之前做了 maven clean 吗?
      猜你喜欢
      • 1970-01-01
      • 2013-03-05
      • 2015-01-10
      • 2020-06-14
      • 2022-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-21
      相关资源
      最近更新 更多