Class ConfigUtils

java.lang.Object
org.springframework.cloud.kubernetes.commons.config.ConfigUtils

public final class ConfigUtils extends Object
Utility class that works with configuration properties.
Author:
Ioannis Canellos
  • Method Details

    • getApplicationName

      public static String getApplicationName(org.springframework.core.env.Environment env, String configName, String configurationTarget)
    • findPrefix

      public static ConfigUtils.Prefix findPrefix(String explicitPrefix, Boolean useNameAsPrefix, boolean defaultUseNameAsPrefix, String normalizedName)
      Parameters:
      explicitPrefix - value of 'spring.cloud.kubernetes.config|secrets.sources.explicitPrefix'
      useNameAsPrefix - value of 'spring.cloud.kubernetes.config|secrets.sources.useNameAsPrefix'
      defaultUseNameAsPrefix - value of 'spring.cloud.kubernetes.config|secrets.defaultUseNameAsPrefix'
      normalizedName - either the name of 'spring.cloud.kubernetes.config|secrets.sources.name' or 'spring.cloud.kubernetes.config|secrets.name'
      Returns:
      prefix to use in normalized sources
    • includeProfileSpecificSources

      public static boolean includeProfileSpecificSources(boolean defaultIncludeProfileSpecificSources, Boolean includeProfileSpecificSources)
      Parameters:
      defaultIncludeProfileSpecificSources - value of 'spring.cloud.kubernetes.config.includeProfileSpecificSources'
      includeProfileSpecificSources - value of 'spring.cloud.kubernetes.config.sources.includeProfileSpecificSources'
      Returns:
      useProfileNameAsPrefix to be used in normalized sources
    • onException

      public static void onException(boolean failFast, Exception e)
      action to take when an Exception happens when dealing with a source.
    • sourceName

      public static String sourceName(String target, String applicationName, String namespace)
    • sourceName

      public static String sourceName(String target, String applicationName, String namespace, String[] profiles)
    • processNamedData

      public static MultipleSourcesContainer processNamedData(List<StrippedSourceContainer> strippedSources, org.springframework.core.env.Environment environment, LinkedHashSet<String> sourceNames, String namespace, boolean decode, boolean includeDefaultProfileData)
      Transforms raw data from one or multiple sources into an entry of source names and flattened data that they all hold (potentially overriding entries without any defined order).
    • processLabeledData

      public static MultipleSourcesContainer processLabeledData(List<StrippedSourceContainer> containers, org.springframework.core.env.Environment environment, Map<String,String> labels, String namespace, boolean decode)
      Transforms raw data from one or multiple sources into an entry of source names and flattened data that they all hold (potentially overriding entries without any defined order).
    • registerSingle

      public static <T> void registerSingle(org.springframework.boot.bootstrap.ConfigurableBootstrapContext bootstrapContext, Class<T> cls, T instance, String name, org.springframework.context.ApplicationListener<?> listener)
    • registerSingle

      public static <T> void registerSingle(org.springframework.boot.bootstrap.ConfigurableBootstrapContext bootstrapContext, Class<T> cls, T instance, String name)
    • keysWithPrefix

      public static Map<String,String> keysWithPrefix(Map<String,String> map, String prefix)
      append prefix to the keys and return a new Map with the new values.