2016-03-02 93 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