Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing encoded password for the datasource used in spring applicationContext.xml
    text
    copied!<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>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload