Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1058885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:05:24+00:00 2026-05-16T18:05:24+00:00

At present i am keeping the password [ unencrypted ] in a property file.

  • 0

At present i am keeping the password [ unencrypted ] in a property file. This password get placed as is in the configuration xml using ant.
[ The configuration xml is for datasource, it is creating the object of dbcp.BasicDataSource ]

Now, is it possible that after the ant target the password is copied in encrypted form. Heard the Jasypt can do that! Till now i haven’t tried this. But, the problem doesn’t end here. BasicDataSource do not accept encrypted password. Is there any replacement for BasicDatasource.

FYI: I am using Spring, if that matters.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:05:24+00:00Added an answer on May 16, 2026 at 6:05 pm

    Create a new task by extending existing task Copy( responsible for file-copy ). Create a new type by extending FilterSet ( responsible for filtering of tokens ).
    see the code here:-
    How to create nested element for ant task?

    build.xml

    <target name="encrypted-copy" >
            <CopyEncrypted todir="dist/xyz/config" overwrite="true">
                <fileset dir="config"/>                 
                <encryptionAwareFilterSet>
                    <filtersfile file="conf/properties/blah-blah.properties" />
                </encryptionAwareFilterSet>
            </CopyEncrypted>
        </target>
    

    blah-blah.properties

    property1=value1
    property2=value2
    PASSWORD=^&YUII%%&*(
    USERNAME=rjuyal
    CONNECTION_URL=...
    someotherproperty=value
    

    configuration xml

    <bean id="dataSource"
            class="com.xyz.datasource.EncryptionAwareDataSource"
            destroy-method="close" autowire="byName">
            <property name="driverClassName">
                <value>com.ibm.db2.jcc.DB2Driver</value>
            </property>
            <property name="url">
                <value>@CONNECTION_URL@</value>
            </property>
            <property name="username">
                <value>@USERNAME@</value>
            </property>
            <property name="password">
                <value>@PASSWORD@</value>
            </property>
            <property name="poolPreparedStatements">
                <value>true</value>
            </property>
            <property name="maxActive">
                <value>10</value>
            </property>
            <property name="maxIdle">
                <value>10</value>
            </property>     
        </bean>
    ...
    ...
    ...
    

    After the execution of the target the xml is copied with values from properties file. Password will be encrypted.

    This will handle the encrypted password.
    EncryptionAwareDataSource

    public class EncryptionAwareDataSource extends BasicDataSource{
        @Override
        public synchronized void setPassword(String password) {     
            super.setPassword(Encryptor.getDecryptedValue( password ));
        }
    }
    

    That’ all 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At present I am using eclipse for JAVA project. I always wanted to use
At present it seems that VS2008 still isn't supported either in the 5.1.5 release
To present user specific data, where do I store the userID of the user
My present contract engagement is at a large E-Commerce company. Their code base which
How can I present a control to the user that allows him/her to select
I need to present the user with a matrix of which one column is
I need to present a wizard once, the first time my windows forms application
I have to present some 'process' or 'flow' of the application at work on
A quick glance at the present-day internet would seem to indicate that Adobe Flash
How should I store (and present) the text on a website intended for worldwide

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.