src/main/java/net/matrix/app/message/CodedMessageDefinitionLoader.java
public static void loadDefinitions(final Locale locale, final Resource resource) {
		try {
			XMLConfiguration config = new XMLConfiguration();
			config.setDelimiterParsingDisabled(true);
			config.load(resource.getInputStream());
			for (HierarchicalConfiguration definitionConfig : config.configurationsAt("definition")) {
				String code = definitionConfig.getString("[@code]");
				String template = definitionConfig.getString("[@template]");
				CodedMessageDefinition.define(new CodedMessageDefinition(code, locale, template));
			}
		} catch (IOException e) {
			LOG.error("加载失败", e);
		} catch (ConfigurationException e) {
			LOG.error("加载失败", e);
		}
	}
public static void loadDefinitions(final Locale locale, final Resource resource) {
		try {
			XMLConfiguration config = new XMLConfiguration();
			config.setDelimiterParsingDisabled(true);
			config.load(resource.getInputStream());
			for (HierarchicalConfiguration definitionConfig : config.configurationsAt("definition")) {
				String code = definitionConfig.getString("[@code]");
				String template = definitionConfig.getString("[@template]");
				CodedMessageDefinition.define(new CodedMessageDefinition(code, locale, template));
			}
		} catch (IOException e) {
			LOG.error("加载失败", e);
		} catch (ConfigurationException e) {
			LOG.error("加载失败", e);
		}
	}
public static void loadDefinitions ( final Locale locale , final Resource resource ) { try { XMLConfiguration config = new XMLConfiguration ( ) ; config . setDelimiterParsingDisabled ( true ) ; config . load ( resource . getInputStream ( ) ) ; for ( HierarchicalConfiguration definitionConfig : config . configurationsAt ( "definition" ) ) { String code = definitionConfig . getString ( "[@code]" ) ; String template = definitionConfig . getString ( "[@template]" ) ; CodedMessageDefinition . define ( new CodedMessageDefinition ( code , locale , template ) ) ; } } catch ( IOException e ) { LOG . error ( "加载失败", e);
 } catch ( ConfigurationException e ) { LOG . error ( "加载失败", e);
 } }
从特定位置加载配置文件。

@param locale
区域
@param resource
配置文件位置
从特定位置加载配置文件。