Class EnvironmentPropertySource

java.lang.Object
org.springframework.core.env.PropertySource<org.springframework.cloud.config.environment.Environment>
org.springframework.cloud.config.server.support.EnvironmentPropertySource

public class EnvironmentPropertySource extends org.springframework.core.env.PropertySource<org.springframework.cloud.config.environment.Environment>
Author:
Spencer Gibb
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.core.env.PropertySource

    org.springframework.core.env.PropertySource.StubPropertySource
  • Field Summary

    Fields inherited from class org.springframework.core.env.PropertySource

    logger, name, source
  • Constructor Summary

    Constructors
    Constructor
    Description
    EnvironmentPropertySource(org.springframework.cloud.config.environment.Environment sources)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    static org.springframework.core.env.StandardEnvironment
    prepareEnvironment(org.springframework.cloud.config.environment.Environment environment)
     
    static Map<String,Object>
    resolveMapPlaceholders(org.springframework.core.env.StandardEnvironment env, Map<String,Object> map)
    Resolve placeholders in a nested Map structure.
    static String
    resolvePlaceholders(org.springframework.core.env.StandardEnvironment preparedEnvironment, String text)
    Resolve placeholders in flat text (used for .properties output).

    Methods inherited from class org.springframework.core.env.PropertySource

    containsProperty, equals, getName, getSource, hashCode, named, toString

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • EnvironmentPropertySource

      public EnvironmentPropertySource(org.springframework.cloud.config.environment.Environment sources)
  • Method Details

    • prepareEnvironment

      public static org.springframework.core.env.StandardEnvironment prepareEnvironment(org.springframework.cloud.config.environment.Environment environment)
    • resolvePlaceholders

      public static String resolvePlaceholders(org.springframework.core.env.StandardEnvironment preparedEnvironment, String text)
      Resolve placeholders in flat text (used for .properties output). Handles escaped placeholders (\${...}) by masking and restoring them.
    • resolveMapPlaceholders

      public static Map<String,Object> resolveMapPlaceholders(org.springframework.core.env.StandardEnvironment env, Map<String,Object> map)
      Resolve placeholders in a nested Map structure. Walks all values recursively, resolving any String values that contain ${...} expressions. Returns a new Map with resolved values — the original is not modified.

      Use this before serializing to YAML or JSON so that the serializer handles multiline values and escaping natively.

    • getProperty

      public Object getProperty(String name)
      Specified by:
      getProperty in class org.springframework.core.env.PropertySource<org.springframework.cloud.config.environment.Environment>