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

org.chenmin.open.objector.Config Maven / Gradle / Ivy

There is a newer version: 0.2.4.1
Show newest version
package org.chenmin.open.objector;

import org.apache.commons.configuration.CompositeConfiguration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;

public class Config {

	public static String get(String key) {
		CompositeConfiguration config = init();
		return config.getString(key);
	}
	
	private static CompositeConfiguration config = null;

	private static CompositeConfiguration init() {
		if(config != null)
			return config;
		CompositeConfiguration config = new CompositeConfiguration();
		// config.addConfiguration(new SystemConfiguration());
		try {
			config.addConfiguration(new PropertiesConfiguration("objector.properties"));
		} catch (ConfigurationException e) {
			e.printStackTrace();
		}
		return config;
	}

	public static void main(String[] args) {
		System.out.println(get("ALIYUN_ACCESS_KEY"));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy