2013-05-10 85 views
0

我有一個普通的普通servlet。我正在嘗試使用Spring ReloadableResourceBundleMessageSource類從文件系統加載屬性文件。該文件位置由JVM參數提供。以下是我的我的MessageSource Bean的聲明JVM參數的彈性問題

<bean id="xmlXpathProperties" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> 
     <!-- check property file(s) every 600 second(10min) --> 
     <property name="cacheSeconds" value="600"/> 
     <property name="basenames"> 
      <list> 
       <value>file:#{systemProperties.aircdrconfig}/cdr-airxml</value> 
      </list> 
     </property> 
/bean> 

如果我有任何特殊字符,如點或連字符給JVM參數名稱( - ),例如(。):air.cdr.config,我越來越像一個例外。

org.springframework.beans.factory.BeanExpressionException Field or property 'air' cannot be found on object of type 'java.util.Properties' 

如果我刪除點符號,那麼它工作正常。任何想法來克服這個問題?提前致謝。

回答

3

您將需要參考的屬性是這樣的:

#{ systemProperties['air.cdr.config'] } 
+0

非常感謝你爲你的快速回復。現在它的工作正常。再次感謝很多 – Dilip 2013-05-14 07:24:07

+0

感謝它爲我工作 – 2014-08-18 06:10:32