java.lang.Object
org.springframework.cloud.config.environment.Environment

public class Environment extends Object
Simple plain text serializable encapsulation of a list of property sources. Basically a DTO for Environment, but also applicable outside the domain of a Spring application.
Author:
Dave Syer, Spencer Gibb
  • Field Details

    • SLASH_PLACEHOLDER

      public static final String SLASH_PLACEHOLDER
      "(_)" is uncommon in a git repo name, but "/" cannot be matched by Spring MVC.
      See Also:
  • Constructor Details

    • Environment

      public Environment(String name, String... profiles)
    • Environment

      public Environment(Environment env)
      Copies all fields except propertySources.
      Parameters:
      env - Spring Environment
    • Environment

      public Environment(String name, String[] profiles, String label, String version, String state)
  • Method Details

    • normalize

      public static String normalize(String s)
      Utility method for normalizing names and labels.
      Parameters:
      s - String to normalize.
      Returns:
      if s contains (_), replace with slash.
    • denormalize

      public static String denormalize(String s)
      Utility method for denormalizing names and labels.
      Parameters:
      s - String to denormalize.
      Returns:
      if s contains slash, replace with (_).
    • add

      public void add(PropertySource propertySource)
    • addAll

      public void addAll(List<PropertySource> propertySources)
    • addFirst

      public void addFirst(PropertySource propertySource)
    • getPropertySources

      public List<PropertySource> getPropertySources()
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getLabel

      public String getLabel()
    • setLabel

      public void setLabel(String label)
    • getProfiles

      public String[] getProfiles()
    • setProfiles

      public void setProfiles(String[] profiles)
    • getVersion

      public String getVersion()
    • setVersion

      public void setVersion(String version)
    • getState

      public String getState()
    • setState

      public void setState(String state)
    • toString

      public String toString()
      Overrides:
      toString in class Object