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