When configuring Hibernate, I met the use of Druid to decrypt the database, leaving a text for the next reference.
1. Encryption and decryption is performed in the SSH framework, respectively:
Pom.xml (Data encryption)
Config.properties (Configure decryption secret key)
So how did these two secret keys come into being?
First we have to download a Druid-1.0.16.jar package (download address: Druid-1.0.16.jar)
Second, type the command JAVA-CP Druid-1.0.16.jar com.alibaba.druid.filter.config.ConfigTools Your_password
This will generate Privatekey,publickey, as well as password, the relevant screenshots are as follows
Note 1: If you are not using Druid-1.0.16.jar, you may only generate a password.
NOTE 2: If not configured well, you may be able to report a large push of strange errors, such as:Org.springframework.beans.factory.BeanCreationException:Error Creatingbean with Name ' Shirofilter ': ....
Configure Druid Decrypt Database password
<bean id= "DataSource" class= "Com.alibaba.druid.pool.DruidDataSource" init-method= "Init" destroy-method= "Close" >
<property name= "url" value= "jdbc:derby:memory:spring-test;create=true"/>
<property Username "value=" sa "/> <property name=" password "value="
okbnxyjcnp7rvimg9npbby2xd2eyesnxgk/ axgk1ylahh771r6w0jtpwf6p8301qdwrsm5mdlygsvady+9xmba== "/>
<property name=" Filters "value=" Config "/>
<property name=" connectionproperties "value=" Config.decrypt=true "/> </bean
>
The main additions to the Configuration Druid decryption database password are two rows of bold configuration.
1, <property name= "connectionproperties" value= "config.decrypt=true"/>
role: Configure Configfilter decryption password
2, <property name= "Filters" value= "config"/>
role: Prompt druid data source needs to decrypt the database password