2012-01-24 35 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属性,因此它与从外部文件加载的属性不同。你尝试过吗?