title: Using properties/variables in jboss-web.xml
body: <p>I have a WAR that is configured to use a scoped classloader under JBoss. This all works fine and dandy. The configuration for it in jboss-web.xml looks something like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE jboss-web PUBLIC
    "-//JBoss//DTD Web Application 4.2//EN"
    "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd"&gt;
  
  &lt;jboss-web&gt;
      &lt;class-loading&gt;
          &lt;loader-repository&gt;
              com.mycompany:loader='com.mycompany.repository'
              &lt;loader-repository-config&gt;java2ParentDelegation=false&lt;/loader-repository-config&gt;
          &lt;/loader-repository&gt;
      &lt;/class-loading&gt;
  &lt;/jboss-web&gt;
  </code></pre>
  
  <p>Now, a client wants to deploy two copies of our WAR file under the same JBoss instance. They are configured to use the same classloader repository, which causes problems.</p>
  
  <p>If I manually change jboss-web.xml inside one copy of the WAR file to specify a different repository, e.g by changing the relevant line to:</p>
  
  <pre><code>            com.mycompany:loader='com.mycompany.repository2'
  </code></pre>
  
  <p>...both copies of the WAR deploy without trouble.</p>
  
  <p>However, hacking the internals of the WAR file isn't a fantastic solution for a customer.</p>
  
  <p>If I could incorporate, say, the context root into the name of the repository (or some other property that is guaranteed to be different between two the two deployments), this could be accomplished automatically.</p>
  
  <p>Is it possible to use properties within jboss-web.xml?, letting me do something like:</p>
  
  <pre><code>            com.mycompany:loader='com.mycompany.repository-${jboss.context-root}'
  </code></pre>
  
  <p>(Note: I made up that property name.)</p>
  
  <p>Stepping back a bit, is there a better way to accomplish what I'm trying to accomplish?</p>