通过spring对hibernate/ibatis的配置文件加密
由于本人优盘丢了,积累的东西都没了 #。#! 所以懒人也得写博客记录些东西
本文参考过网上的例子,具体出处已经不详...
对信息的加密是用的DES(具体加密方法的选用,可自行选择)
public class MyConfigurer extends PropertyPlaceholderConfigurer{ @Override protected void processProperties( ConfigurableListableBeanFactory beanFactory, Properties props) throws BeansException { System.out.println("MyConfigurer!"); String UserName = props.getProperty("jdbc.UserName"); if (UserName != null ) { props.setProperty("jdbc.UserName", DESUtil.getDesString(UserName)); } String password = props.getProperty("jdbc.PassWord"); if (password != null ) { props.setProperty("jdbc.PassWord", DESUtil.getDesString(password)); } super.processProperties(beanFactory, props); }}