2012-01-24 34 views
0

在我的applicationContext.xml我有這個spring配置

<context:property-placeholder location="file:#{ systemProperties['outsideConfigFile'] }" /> 

我開始了我的tomcat與-DoutsideConfigFile = /路徑/要/我的/ file.properties(認證)

這似乎並沒有工作,我得到

INFO : org.springframework.beans.factory.config.PropertyPlaceholderConfigurer - Loading properties file from URL [file:#{ systemProperties['outsideConfigFile'] }] 

然後

ERROR: org.springframework.web.context.ContextLoader - Context initialization failed 
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: (No such file or directory) 

有沒有人有anyideas如何得到它的工作?我認爲問題在於Spring無法讀取給定的系統屬性文件。

非常感謝 - MB

+0

解釋你的意思似乎並不奏效? –

+0

「似乎不起作用」是什麼意思?你會得到一個異常?春天不加載?春天說財產沒有價值? –

+0

更新問題,對不起,好點。 –

回答

0

如Spring所示,無法找到該文件。

嘗試使用:-DoutsideConfigFile = file:/path/to/my/file.properties根據Spring Resource Loader docs。

0

如何使用$ {}?由於它是一個System屬性,因此它與從外部文件加載的屬性不同。你嘗試過嗎?