src/main/java/net/matrix/app/configuration/ConfigurationContext.java
public <T extends ReloadableConfigurationContainer> T getConfiguration(final Class<T> type, final ResourceSelection selection)
		throws ConfigurationException {
		Resource resource = getConfigurationResource(selection);
		T container = (T) containerCache.get(resource);
		if (container != null) {
			container.checkReload();
			return container;
		}
		synchronized (containerCache) {
			container = (T) containerCache.get(resource);
			if (container != null) {
				container.checkReload();
				return container;
			}
			try {
				container = type.newInstance();
			} catch (ReflectiveOperationException e) {
				throw new ConfigurationException("配置类 " + type.getName() + " 实例化失败", e);
			}
			// 加载配置
			LOG.debug("从 {}({}) 加载配置", selection, resource);
			try {
				container.load(resource);
			} catch (ConfigurationException e) {
				throw new ConfigurationException("配置 " + resource.getDescription() + " 加载错误", e);
			}
			containerCache.put(resource, container);
			return container;
		}
	}
public <T extends ReloadableConfigurationContainer> T getConfiguration(final Class<T> type, final ResourceSelection selection)
		throws ConfigurationException {
		Resource resource = getConfigurationResource(selection);
		T container = (T) containerCache.get(resource);
		if (container != null) {
			container.checkReload();
			return container;
		}
		synchronized (containerCache) {
			container = (T) containerCache.get(resource);
			if (container != null) {
				container.checkReload();
				return container;
			}
			try {
				container = type.newInstance();
			} catch (ReflectiveOperationException e) {
				throw new ConfigurationException("配置类 " + type.getName() + " 实例化失败", e);
			}
			// 加载配置
			LOG.debug("从 {}({}) 加载配置", selection, resource);
			try {
				container.load(resource);
			} catch (ConfigurationException e) {
				throw new ConfigurationException("配置 " + resource.getDescription() + " 加载错误", e);
			}
			containerCache.put(resource, container);
			return container;
		}
	}
加载配置资源，返回配置对象。

@param <T>
配置对象的类型
@param type
配置对象的类型
@param selection
配置资源选择
@return 配置对象
@throws ConfigurationException
配置错误