【问题标题】:PropertyPlaceholderConfigurer is not able to ignore the properties file even ignoreResourceNotFound=truePropertyPlaceholderConfigurer 甚至无法忽略属性文件 ignoreResourceNotFound=true
【发布时间】:2011-12-01 12:42:29
【问题描述】:

applicationContext.xml

  <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 开始 严重:上下文 [/upload] 由于以前的错误而启动失败

我卡得很厉害... :(

【问题讨论】:

标签: spring


【解决方案1】:

问题可能是您所在位置的“#”(&lt;property name="location" value="file:/#{contextParameters.emsPropLocation}"/&gt;)。不应该是“$”吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-05
    • 1970-01-01
    • 2015-03-07
    • 1970-01-01
    • 2013-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多