title: How to load tomcat jndi resource/context on a specific web app deploy event
body: <p>I have a web application which gets database connection via a jndi resource tag in either <code>&lt;GlobalNamingResources&gt;</code> tag in <code>server.xml</code> or <code>&lt;Context&gt;</code> tag in <code>context.xml</code>.</p>
  
  <p>But even either of the cases, the resource gets invoked for every web app in the Tomcat, Is there a way to define the resource to load only for a specific web app.</p>
  
  <p>I am also restricted to have the resource defined in the applications <code>context.xml</code>, as I am asked to have the DB config outside the application/WAR file.</p>
  
  <p>Presently, I have kept it in <code>&lt;GlobalNamingResources&gt;</code> tag and its gets loaded for all web apps.</p>
  
  <p>Any ideas?</p>