问题描述
- java ssh关于配置文件加密的问题
-
package com.imcc.breakdown.util.encrypt;import java.util.Properties;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
import org.hibernate.connection.DriverManagerConnectionProvider;import com.imcc.breakdown.action.wechat.aes.AESSecurityUtil;
//配置文件AES加密
public class MyDriverManagerConnectionProvider extends DriverManagerConnectionProvider {public MyDriverManagerConnectionProvider() { super(); } @Override public void configure(Properties props) throws HibernateException { String url =props.getProperty(Environment.URL); String user = props.getProperty(Environment.USER); String password = props.getProperty(Environment.PASS); props.setProperty(Environment.USER,AESSecurityUtil.decode(user, Password.password)); props.setProperty(Environment.PASS, AESSecurityUtil.decode(password, Password.password)); props.setProperty(Environment.URL, AESSecurityUtil.decode(url, Password.password)); super.configure(props); }
}
解决方案
参考:http://blog.csdn.net/ycyangcai/article/details/7407277
时间: 2024-09-18 05:41:34