To decrypt and connect connection information before the database connection configuration file

Source: Internet
Author: User
Tags decrypt

Technology Exchange Group: 233513714

1, if the database connection password is not encrypted when the connection configuration mode is

    <BeanID= "Anteaterds"class= "Org.apache.commons.dbcp.BasicDataSource">        < Propertyname= "Driverclassname"value= "${jdbc.driverclassname}"/>        < Propertyname= "url"value= "${jdbc.url}"/>        < Propertyname= "username"value= "${jdbc.username}"/>        < Propertyname= "Password"value= "${jdbc.password}"/>    </Bean>

It is important to note that the class is pointing to "Org.apache.commons.dbcp.BasicDataSource"

2, if you change the connection information before connecting to the database to decrypt the configuration should be changed to

    <BeanID= "Anteaterds"class= "Com.bestpay.insurance.dal.initialization.InitDateSourse">        < Propertyname= "Driverclassname"value= "${jdbc.driverclassname}"/>        < Propertyname= "url"value= "${jdbc.url}"/>        < Propertyname= "username"value= "${jdbc.username}"/>    </Bean>

It is important to note that this time the orientation of class has changed, and the implementation of this class needs to be written by ourselves, and this implementation class needs to inherit the Basicdatasource,initdatesource implementation class as follows

Import Com.bestpay.insurance.common.utils.Base64Util; Import Com.bestpay.insurance.common.utils.PropertyReader; Import Org.apache.commons.dbcp.BasicDataSource;  Public class extends Basicdatasource {    public  initdatesourse () {        thisnew String (Base64util.decode (Propertyreader.getvalue ("Jdbc.password")));     }

As shown above, this time only the specific password decryption assignment can be

To decrypt and connect connection information before the database connection configuration file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.