0

我從Git存儲庫導入了一個項目。當我嘗試部署到ESB時,部署失敗並報告找不到屬性文件。 //org.springframework.beans.factory.BeanInitializationException:無法加載屬性;嵌套異常是java.io.FileNotFoundException:類路徑資源[config.properties]無法打開,因爲它不存在 at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBean Factory(PropertyResourceConfigurer.java:89)〜 [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessor (PostProcessorRegistrationDelegate.java:265)〜[spring-context-4.1.6。 RELEASE.jar:4.1.6.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors (PostProcessorRegistrationDelegate.java:162)〜[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE ]從Mule中的.properties文件加載時FilenotFound異常3.8

我正在使用屬性文件來獲取多個環境的詳細信息,並且基於環境名稱,我正在拾取該文件並在src/main/resources文件夾下進行復制。但是,即使我能夠看到文件被正確拾取並複製到位置src/main/resources。 其他人似乎已經能夠成功部署它。我嘗試將屬性文件移動到src/main/resources文件夾中,結果相同。 爲什麼ESB不能找到位於/ src/main/resources中的屬性文件?

下面的代碼片段:

回答

0

保持你的config.properties文件在類路徑中,並參考其如下

<context:property-placeholder location="config.properties" /> 
相關問題