简体   繁体   English

com.typesafe.config.ConfigFactory.load(Config) 有什么作用?

[英]What does com.typesafe.config.ConfigFactory.load(Config) do?

What does the method load(Config) in class com.typesafe.config.ConfigFactory do? class com.typesafe.config.ConfigFactory中的方法load(Config)有什么作用? How would the output Config be different from the input Config? output 配置与输入配置有何不同?

The documentation says that it: 文档说:

Assembles a standard configuration using a custom Config object rather than loading "application.conf".使用自定义配置 object 组装标准配置,而不是加载“application.conf”。 The Config object will be sandwiched between the default reference config and default overrides and then resolved.配置 object 将夹在默认参考配置和默认覆盖之间,然后解析。

I do not understand what it is saying.我不明白它在说什么。

The code shows that:代码显示:

public static Config load(Config config) {
    return load(checkedContextClassLoader("load"), config);
}

It seems to be loading with a checkedContextClassLoader which I don't understand.它似乎正在加载我不明白的checkedContextClassLoader Can someone give a short understandable explanation of this?有人可以对此给出一个简短易懂的解释吗?

How would the output Config be different from the input Config? output 配置与输入配置有何不同?

It has the reference config (loaded from reference.conf ) as fallback for anything not defined in the input Config , and then overrides from system properties are applied ("Future versions may get overrides in more places. It is not guaranteed that this method only uses system properties.").它具有参考配置(从reference.conf加载)作为输入Config中未定义的任何内容的后备,然后应用来自系统属性的覆盖(“未来版本可能会在更多地方获得覆盖。不保证仅此方法使用系统属性。”)。

It seems to be loading with a checkedContextClassLoader which I don't understand.它似乎正在加载我不明白的checkedContextClassLoader。

I don't think this is an important part.我不认为这是一个重要的部分。 This is simply the default classloader used by the library.这只是库使用的默认类加载器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM