2017-09-26 83 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