Class SystemEnvProperties

All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class SystemEnvProperties extends Properties

An utility class to resolve the value of a key based on the environment variables and system properties available at runtime. In most cases, you do not want to resolve whatever system variable is available at runtime but specify which ones can be used when resolving placeholders.

To resolve to an environment variable, the key must have a format like env.<key> where key is the name of an environment variable. For system properties, there is no specific format and the value is resolved from a system property that matches the key.

Author:
Stian Thorgersen
See Also:
  • Field Details

    • UNFILTERED

      public static final SystemEnvProperties UNFILTERED

      An variation of SystemEnvProperties that gives unrestricted access to any system variable available at runtime. Most of the time you don't want to use this class but favor creating a SystemEnvProperties instance that filters which system variables should be available at runtime.

  • Constructor Details

    • SystemEnvProperties

      public SystemEnvProperties(Set<String> allowedSystemVariables)
      Creates a new instance where system variables where only specific keys can be resolved from system variables.
      Parameters:
      allowedSystemVariables - the keys of system variables that should be available at runtime
  • Method Details