Interface Config.Builder

  • All Superinterfaces:
    Builder<Config>, Supplier<Config>
    Enclosing interface:
    Config

    public static interface Config.Builder
    extends Builder<Config>
    Config Builder.

    A factory for a Config object.

    The application can set the following characteristics:

    In case of ConfigMapperProviders, if there is no one that could be used to map appropriate type, the mapping attempt throws a ConfigMappingException.

    A more sophisticated approach can be achieved using the "config beans" module, that provides reflection access and mapping for static factory methods, constructors, builder patterns and more.

    If a ConfigSource is not specified, following default config source is used. Same as Config.create() uses. It builds composite config source from following sources, checked in order:

    1. Tries to load configuration from meta one of following meta configuration files on classpath, in order:
      1. meta-config.yaml - meta configuration file in YAML format
      2. meta-config.conf - meta configuration file in HOCON format
      3. meta-config.json - meta configuration file in JSON format
      4. meta-config.properties - meta configuration file in Java Properties format
    2. Otherwise, configuration consists of:
      1. Environment variables;
      2. or else System properties
      3. one of following files on classpath, checked in order:
        1. application.yaml - configuration file in YAML format
        2. application.conf - configuration file in HOCON format
        3. application.json - configuration file in JSON format
        4. application.properties - configuration file in Java Properties format
    It uses the first and only one file that exists and there is a ConfigParser available that supports appropriate media type. Available parser means that the parser:
    1. is loaded as a service using ServiceLoader;
    2. or if it does not exist, a config core built-in parser is used, if exists.
    See Also:
    Config.create(), ConfigSource, ConfigParser, ConfigFilter