2014-09-02 56 views
0

我已將spring.profiles.active環境變量配置到websphere服務器,並將變量值用於spring配置文件。 我config.xml會像春季個人資料未被挑選屬性值從服務器環境?

<bean id="propertiesUtil" class="common.PropertiesUtil"> 
    <property name="locations"> 
     <list> 
      <value>classpath:common.properties</value> 
      <value>classpath:${spring.profiles.active}/env_${spring.profiles.active}_config.properties</value> 
     </list> 
    </property> 

並獲得異常,同時部署應用到WAS是這樣的:

Caused by: java.io.FileNotFoundException: class path resource 
[${spring.profiles.active}/env_${spring.profiles.active}_config.properties] 
cannot be opened because it does not exist 

請讓我知道如果我錯過了什麼?

+0

您確實配置了 2014-09-02 10:12:13

+0

不,我只配置了豆 – lilhore 2014-09-02 10:16:16

+0

然後佔位符將無法工作。您需要添加佔位符configurere才能替換佔位符。 – 2014-09-02 10:18:54

回答

0

謝謝, 它的工作,我已經從WAS環境中獲取spring.profiles.active變量的值,並存儲到上下文範圍。