/** * Return a Map of all values from the specified {@link PropertySources} that start * with a particular key. * @param propertySources the property sources to scan * @param keyPrefix the key prefixes to test * @return a map of all sub properties starting with the specified key prefixes. * @see PropertySourceUtils#getSubProperties(PropertySources, String, String) */ public static Map<String, Object> getSubProperties(PropertySources propertySources, String keyPrefix) { return PropertySourceUtils.getSubProperties(propertySources, null, keyPrefix); }
/** * Return a Map of all values from all underlying properties that start with the * specified key. NOTE: this method can only be used if the underlying resolver is a * {@link ConfigurableEnvironment}. * @param keyPrefix the key prefix used to filter results * @return a map of all sub properties starting with the specified key prefix. * @see PropertySourceUtils#getSubProperties */ public Map<String, Object> getSubProperties(String keyPrefix) { Assert.isInstanceOf(ConfigurableEnvironment.class, this.resolver, "SubProperties not available."); ConfigurableEnvironment env = (ConfigurableEnvironment) this.resolver; return PropertySourceUtils.getSubProperties(env.getPropertySources(), this.prefix, keyPrefix); }