All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springframework.biz.config.EncryptPropertyPlaceholderConfigurer Maven / Gradle / Ivy

There is a newer version: 1.0.7.RELEASE
Show newest version
package org.springframework.biz.config;

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 EncryptPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {

	/**
	 * 重写父类处理过程
	 */
	protected void processProperties(ConfigurableListableBeanFactory beanFactory,Properties props) throws BeansException {
		super.processProperties(beanFactory, props);
		//load properties to ctxPropertiesMap  
        for (Object key : props.keySet()) {  
            String keyStr = key.toString();  
            String value = props.getProperty(keyStr);  
            props.setProperty(keyStr, convertPropertyValue(value));
        } 
	}
	
	protected String convertPropertyValue(String originalValue) {
		String value = originalValue; 
		/*try {
			value = p.dCode(value.getBytes("UTF-8"));
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}*/
		return value;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy