2016-03-02 94 views
0

我在applicationcontext.xml中聲明瞭屬性,並將external.conf作爲jvm參數傳遞。我能夠讀取屬性文件中的值而不存在問題。Spring佔位符未解決

<util:properties id="hbaseProperties" location="file:///${external.conf}/props/hbase.properties"></util:properties>

如果我在財產文件,如下添加關鍵,它未能解決外部的conf及其越來越打印爲$ {} external.conf /hdfs-site.xml

site_xml = ${external.conf}/hdfs-site.xml

我不知道爲什麼這沒有得到解決。應該做些什麼才能使它工作。

回答

0

添加在你的applicationContext.xml下面的代碼片段

<context:property-placeholder location="<pathToYourPropertyFile>/external.conf"/> 

有關財產佔位機制看詳細信息的spring documentation