The database connection information is described in the following steps:
1. Configure the properties file.
2. Configure the spring configuration file.
The code for Step 1 is as follows:
Pts4.jdbc.driverclassname=com.mysql.jdbc.driver pts4.jdbc.url=jdbc:mysql://localhost:3306/acmeeting Pts4.jdbc.username=enc (t3b1ivb7jirlgf9lkrmsqa==) Pts4.jdbc.password=enc (2g69lhqhtq8fzrz8f5dmew==)
The code for Step 2 is as follows:
<bean id= "Environmentvariablesconfiguration" class= " Org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig "> <property name=" algorithm "value=" Pbewithmd5anddes "/> <property name=" password "value=" Jasypt "/> </bean> <!--Specify encrypted class--<bean ID = "Configurationencryptor" class= "Org.jasypt.encryption.pbe.StandardPBEStringEncryptor" > <property name= " Config "ref=" environmentvariablesconfiguration "/> </bean> <!--read Properties file--<bean id=" Propertyconfigurer "class=" Org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfigurer "> < Constructor-arg ref= "Configurationencryptor"/> <property name= "Locations" > <list> <value> classpath:db.properties</value> </list> </property> </bean>
Encryption of database special fields as long as the mapping configuration file settings for hibernate, the code is as follows:
Configure a typedef and then set the Type property on the special field that you want to encrypt.