Passing encrypted properties to spring context

I never seen this but I wondering if somebody has come across. Having a web server which access a database. I want to pass the database password encrypted and have spring context decrypting it before setting the datasource. I know the spring security can do some of this like using a salt file in the web server, etc.

The challenge here is that I don't want to give a clear user,password,url to the web server team. Just an encrypted password and have spring decrypted before using it.

Is there something like this already? I know I could code something but is it already done?



By using an object, an application would be able to correctly read and use a .properties file like this:


Note that the database password is encrypted (in fact, any other property could also be encrypted, be it related with database configuration or not).

More information :

I actually found exactly what I was looking for in this thread:

How to use encrypted password in apache BasicDataSource? Here are the details from jasyp

This problem and solution to it is explained here..(link)



  1. Encrypt db.Properties


The spring beans configuration for the datasource would look like this (here you may use only password part)

  1. spring-beans.xml

    <bean id="dataSource" destroy-method="close"  class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="db#[driverClassName]" />
        <property name="url" value="db#[url]" />
        <property name="username" value="db#[username]" />
        <property name="password" value="encryptedDb#[password]" />
     <bean id="dbPropertyPlaceholder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
     <property name="locations">  
         <property name="placeholderPrefix" value="db#[" />
         <property name="placeholderSuffix" value="]" />  
      <bean id="encryptedDbPropertyPlaceholder"  class="com.inventory.api.util.DecryptPropertyConfigurer">  
        <property name="locations">  
        <property name="placeholderPrefix" value="encryptedDb#[" />  
        <property name="placeholderSuffix" value="]" /&gt;  

And so on.. please refer given link for more information..

Need Your Help

Numpy bincount() with floats

python numpy

I am trying to get a bincount of a numpy array which is of the float type:

How to check when HealthKit function has been completed (Swift)

ios swift function health-kit completionhandler

Well, the title really says it all, and I haven't been able to find an answer anywhere that works for me so I am turning to StackOverFlow. I am trying to get a users step count and assign that valu...