2011-12-01 37 views
3

的applicationContext.xmlPropertyPlaceholderConfigurer不能忽略屬性文件甚至ignoreResourceNotFound =真

<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
    <property name="ignoreResourceNotFound" value="true"/> 
    <property name="location" value="file:/#{contextParameters.emsPropLocation}"/> 
    </bean> 

    <!-- TIBCO Connection Factory Bean --> 
    <bean id="tibcoConnectionFactory" class="com.tibco.tibjms.TibjmsConnectionFactory" lazy-init="true"> 
    <constructor-arg value="${emsServerURL}"/> 
    <property name="userName" value="${emsUserName}"/> 
    <property name="userPassword" value="${emsPassword}"/> 
    <property name="connAttemptCount" value="${connAttemptCount}"/> 
    <property name="connAttemptDelay" value="${connAttemptDelay}"/> 
    <property name="connAttemptTimeout" value="${connAttemptTimeout}"/> 
    <property name="reconnAttemptCount" value="${reconnAttemptCount}"/> 
    <property name="reconnAttemptDelay" value="${reconnAttemptDelay}"/> 
    <property name="reconnAttemptTimeout" value="${reconnAttemptTimeout}"/> 
    </bean> 

的web.xml

<context-param> 
    <param-name>emsPropLocation</param-name> 
    <param-value>D:/nsserver/config/EMSServerConf.properties</param-value> 
</context-param> 

如果EMSServerConf.properties文件不存在時指定的位置,「org.springframework.web.context.ContextLoaderListener」偵聽器無法正確加載applicationContext.xml文件。儘管ignoreResourceNotFound屬性設置爲「true」。

其實,我想讓這個屬性文件是可選的。

錯誤在Tomcat服務器

2011年12月1日下午6時08分51秒開始org.apache.catalina.core.StandardContext嚴重 :錯誤listenerStart 2011年12月1日下午6時08分51秒org.apache.catalina.core.StandardContext開始 重度:上下文[/上傳]啓動失敗由於先前的錯誤

我堅持不好... :(

+2

可能的重複[我們可以加載「org.springframework.beans.factory.config.PropertyPlaceholderConfigurer」bean with lazy-init =「true」?](http://stackoverflow.com/questions/8337652/can-we -load-org-springframework-beans-factory-config-propertyplaceholderconfigu) – axtavt

+0

'ignoreUnresolvablePlaceholders' –

+0

我試圖設置ignoreUnresolvablePlaceholders = true,但它沒有奏效。 – user1065374

回答

-1

這個問題可能在「#」您的位置(<property name="location" value="file:/#{contextParameters.emsPropLocation}"/>)它不是「$」嗎?