title: How to include properties from external file to hibernate.cfg.xml?
body: <p>I need to be able to store database config properties in <code>src|main|java|dbConnection.properties</code> and  include it to <code>hibernate.cfg.xml</code> in form of <strong>jstl</strong> expressions. (like : ${password} etc.). How to do it?</p>
  
  <p><strong>Current hibernate.cfg.xml:</strong></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD//EN"
          "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
  &lt;property name="connection.driver_class"&gt;org.postgresql.Driver&lt;/property&gt;
          &lt;property name="connection.username"&gt;postgres&lt;/property&gt;
          &lt;property name="connection.password"&gt;postgres&lt;/property&gt;
          &lt;property name="transaction.factory_class"&gt;org.hibernate.transaction.JDBCTransactionFactory&lt;/property&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p><strong>I need something like this:</strong></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
      &lt;!DOCTYPE hibernate-configuration PUBLIC
              "-//Hibernate/Hibernate Configuration DTD//EN"
              "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
      &lt;hibernate-configuration&gt;
          &lt;session-factory&gt;
      &lt;property name="connection.driver_class"&gt;${DRIVER}&lt;/property&gt;
              &lt;property name="connection.username"&gt;${USERNAME}&lt;/property&gt;
              &lt;property name="connection.password"&gt;${PASSWORD}&lt;/property&gt;
              &lt;property name="transaction.factory_class"&gt;org.hibernate.transaction.JDBCTransactionFactory&lt;/property&gt;
          &lt;/session-factory&gt;
      &lt;/hibernate-configuration&gt;
  </code></pre>