title: Using encoded password for the datasource used in spring applicationContext.xml
body: <p>I want to keep encoded password in my below mentioned springApplicationContext.xml</p>
  
  <p>Is there any way to achieve this? </p>
  
  <p>presently I have configured all properties using property-placeholder
  as shown below but the raw password is still open in my database.properties</p>
  
  <h2>springApplicationContext.xml</h2>
  
  <pre><code>&lt;beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;
          &lt;beans:property name="driverClassName"&gt;&lt;beans:value&gt;${db.driverClassName}&lt;/beans:value&gt;&lt;/beans:property&gt;
          &lt;beans:property name="url"&gt;&lt;beans:value&gt;${db.url}&lt;/beans:value&gt;&lt;/beans:property&gt;
          &lt;beans:property name="username"&gt;&lt;beans:value&gt;${db.username}&lt;/beans:value&gt;&lt;/beans:property&gt;
          &lt;beans:property name="password"&gt;&lt;beans:value&gt;${db.password}&lt;/beans:value&gt;&lt;/beans:property&gt;
  &lt;/beans:bean&gt;
  </code></pre>
  
  <p>but actual values are present in my <code>database.properties</code></p>
  
  <pre><code>db.driverClassName=com.mysql.jdbc.Driver
  db.url=jdbc:mysql://localhost/myDB
  db.username=root
  db.password=root
  </code></pre>
  
  <p>I want something like below:</p>
  
  <h2>springApplicationContext.xml (same as above)</h2>
  
  <pre><code>&lt;beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;
          &lt;beans:property name="driverClassName"&gt;&lt;beans:value&gt;${db.driverClassName}&lt;/beans:value&gt;&lt;/beans:property&gt;
          &lt;beans:property name="url"&gt;&lt;beans:value&gt;${db.url}&lt;/beans:value&gt;&lt;/beans:property&gt;
          &lt;beans:property name="username"&gt;&lt;beans:value&gt;${db.username}&lt;/beans:value&gt;&lt;/beans:property&gt;
          &lt;beans:property name="password"&gt;&lt;beans:value&gt;${db.password}&lt;/beans:value&gt;&lt;/beans:property&gt;
  &lt;/beans:bean&gt;
  </code></pre>
  
  <p>But password property value should be in encripted format in my <code>database.properties</code></p>
  
  <pre><code>db.driverClassName=com.mysql.jdbc.Driver
  db.url=jdbc:mysql://localhost/myDB
  db.username=root
  db.password=3g6n72ef8x (using any encription method).
  </code></pre>
  
  <p>and my dataSource internally decrypt the password before making new DB connection.</p>
  
  <p>Highly appreciate for any help/suggestion in this.</p>