(no commit message)
[utils] / system / spring / src / main / java / org / wamblee / system / spring / PropertySetter.java
1 package org.wamblee.system.spring;
2
3 import java.util.Properties;
4
5 import org.springframework.beans.BeansException;
6 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
7 import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
8
9 /**
10  * Bean that provides postprocessing of the bean factory based on 
11  * a given set of properties. 
12  * 
13  * @author Erik Brakkee
14  */
15 class PropertySetter extends PropertyPlaceholderConfigurer {
16
17         /**
18          * Constructs the property setter. 
19          * @param aProps Properties. 
20          */
21         public PropertySetter(Properties aProps) { 
22                  StringBuffer buf = new StringBuffer();  
23                  for (Object key: aProps.keySet()) {  
24                          buf.append(key);
25                          buf.append("=");
26                          buf.append(aProps.get(key));
27                          buf.append("\n");
28                  } 
29                  setLocation(new StringResource(buf.toString()));
30         }
31 }