Class EnvConfigSource

  • All Implemented Interfaces:
    Serializable, org.eclipse.microprofile.config.spi.ConfigSource

    public class EnvConfigSource
    extends AbstractConfigSource
    A ConfigSource to access Environment Variables following the mapping rules defined by the MicroProfile Config specification.

    For a given property name foo.bar.baz, is matched to an environment variable with the following rules:

    1. Exact match (foo.bar.baz)
    2. Replace each character that is neither alphanumeric nor _ with _ (foo_bar_baz)
    3. Replace each character that is neither alphanumeric nor _ with _; then convert the name to upper case (FOO_BAR_BAZ)

    Additionally, this implementation provides candidate matching dotted property name from the Environment Variable name. These are required when a consumer relies on the list of properties to find additional configurations. The MicroProfile Config specification defines a set of conversion rules to look up and find values from environment variables even when using their dotted version, but it is unclear about property names.
    Because an environment variable name may only be represented by a subset of characters, it is not possible to represent exactly a dotted version name from an environment variable name, so consumers must be aware of such limitations.

    See Also:
    Serialized Form
    • Constructor Detail

      • EnvConfigSource

        protected EnvConfigSource()
      • EnvConfigSource

        protected EnvConfigSource​(int ordinal)
      • EnvConfigSource

        public EnvConfigSource​(Map<String,​String> properties,
                               int ordinal)