2017-09-26 86 views
0

在我的Maven项目,我需要让我用资源来读这是在其他项目属性以出口为主,并宣读他们在我的项目出口属性隐藏XML

<resources> 
     <resource> 
      <directory>src/main/resources/config</directory> 
      <filtering>false</filtering> 
      <includes> 
       <include>**/*</include> 
      </includes> 
     </resource> 
     <resource> 
      <directory>src/main/java</directory> 
      <includes> 
       <include>**/*.*</include> 
      </includes> 
      <excludes> 
       <exclude>**/*.class</exclude> 
       <exclude>**/*.java</exclude> 
      </excludes> 
     </resource> 
    </resources> 

这是构建在POM .xml在包含资源的项目中,现在在sr/main/resources/spring下的项目中我有一个xml文件,它定义了我的bean,在我添加资源后导出属性这个xml文件“无法找到”得到这个异常,当我运行maven构建

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

如果我rem有没有例外的资源出现,任何人之前都面临过这个问题,或者知道这种行为背后的原因是什么?

回答

0

你如何加载小枝bean xml?看起来像加载上下文时缺少一个/。它应该是/spring/my-beans.xml