title: Spring resource
body: <p>Problem: I want to make the below bean definitions (specified in aaplicationContext.xml) optional for "org.springframework.web.context.ContextLoaderListener". If i am not providing the "emsPropLocation" context parameter correctly, tomcat web container is not able to initialized properly and it is obvious reason. Is there any way to make it optional?  </p>
  
  <p><strong>appicationContext.xml:</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>  &lt;bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
      &lt;property name="ignoreResourceNotFound" value="false"/&gt;
      &lt;property name="location" value="file:/#{contextParameters.emsPropLocation}" /&gt;
    &lt;/bean&gt;
  
    &lt;!-- TIBCO Connection Factory Bean --&gt;
    &lt;bean id="tibcoConnectionFactory" class="com.tibco.tibjms.TibjmsConnectionFactory"&gt;
      &lt;constructor-arg value="${emsServerURL}"/&gt;
      &lt;property name="userName" value="${emsUserName}"/&gt;
      &lt;property name="userPassword" value="${emsPassword}"/&gt;
      &lt;property name="connAttemptCount" value="${connAttemptCount}"/&gt;
      &lt;property name="connAttemptDelay" value="${connAttemptDelay}"/&gt;
      &lt;property name="connAttemptTimeout" value="${connAttemptTimeout}"/&gt;
      &lt;property name="reconnAttemptCount" value="${reconnAttemptCount}"/&gt;
      &lt;property name="reconnAttemptDelay" value="${reconnAttemptDelay}"/&gt;
      &lt;property name="reconnAttemptTimeout" value="${reconnAttemptTimeout}"/&gt;
    &lt;/bean&gt;
  
  
    &lt;!-- bean id="tibcoUtil" class="com.nr.ns.upload.TibcoUtil" scope="singleton"&gt;
      &lt;constructor-arg value="true"/&gt;
    &lt;/bean--&gt;
  
    &lt;bean id="jmsExceptionListener" class="com.nr.ns.upload.LogMsgExceptionListener"/&gt;
  
    &lt;!-- Spring CachingConnectionFactory Bean --&gt;
    &lt;bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"&gt;
      &lt;constructor-arg ref="tibcoConnectionFactory"/&gt;
      &lt;property name="reconnectOnException" value="${reconnectOnException}"/&gt;
      &lt;property name="sessionCacheSize" value="${sessionCacheSize}"/&gt;
      &lt;property name="exceptionListener" ref="jmsExceptionListener"/&gt;
    &lt;/bean&gt; 
  
    &lt;!-- JMSTemplate Bean --&gt;
    &lt;bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"&gt;
      &lt;constructor-arg ref="connectionFactory"/&gt;
      &lt;property name="receiveTimeout" value="${receiveTimeout}"/&gt;
      &lt;property name="deliveryMode" value="${deliveryMode}"/&gt;
    &lt;/bean&gt;
  </code></pre>
  
  <p>We are keeping WAR file outside tomcat and to make it happen we have "app.xml" file inside TOMCAT_HOME/conf/Catalina/localhost. </p>
  
  <p><strong>app.xml:</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Context path="/app"
      docBase="/abc/ccp/app.war"
      reloadable="true"
      unpackWAR="false"&gt;
  
      &lt;Parameter name="emsPropLocation"
          value="/xyz/config/EMSServerConf.properties"
          override="false"/&gt;
  &lt;/Context&gt;
  </code></pre>