import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
@Service
public class ResourceMap {
private static Map
resourceMap = init();
private static Logger log =Logger.getLogger( ResourceMap.class.getName() );
private static Map init() {
// TODO Auto-generated method stub
Map initMap = new ConcurrentHashMap();
List fileList = getAllPropertiesFile("TestProperties");
for(File f : fileList){
Properties prop = getProperties(f);
propTransIntoMap(initMap,prop);
}
return initMap;
}
public String get(String key){
return resourceMap.get(key);
}
private static void propTransIntoMap(Map initMap,
Properties prop) {
// TODO Auto-generated method stub
Set
阅读(885) | 评论(0) | 转发(0) |