ssh中資料庫配置檔案加密方法
阿新 • • 發佈:2018-11-12
在applicationContext.xml檔案中
<bean id="propertyConfigurer" class="com.common.util.ProPertyPlaceholderConfigure">
<property name="locations"><value>classpath:application.properties</value>
</list>
</property>
<property name="fileEncoding" value="utf-8"/>
</bean>
package com.common.util;
import java.util.Properties;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
public class ProPertyPlaceholderConfigure extends PropertyPlaceholderConfigurer{
throws BeansException{
props.setProperty("jdbc.password", RSAUtils.decritp(props.getProperty("jdbc.password")));
super.processProperties(beanFactory, props);
}
}