学习日志:对DB.properties文件使用DES加密,通过重写PropertyPlaceholderConfigurer类对properties文件进行解密,然后Mybatis读取spring DataResource。
配置文件如下:
classpath:DB.properties
PropertyPlaceholderConfigurer 重写如下:
public class MyPropertyLoader extends PropertyPlaceholderConfigurer {
@Override
protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
throws BeansException {
String url = (String) props.getProperty("url");
String username = props.getProperty("username");
String password = props.getProperty("password");
String pw = PassWord.getPass