List of usage examples for org.springframework.core.env MutablePropertySources forEach
default void forEach(Consumer<? super T> action)
From source file:ch.sdi.core.TestUtils.java
/** * Removes all key/value pairs from environment * @param aEnv//from ww w . j av a 2 s.co m */ public static void removeAllFromEnvironment(ConfigurableEnvironment aEnv) { MutablePropertySources propertySources = aEnv.getPropertySources(); List<PropertySource<?>> toRemove = new ArrayList<PropertySource<?>>(); propertySources.forEach(p -> toRemove.add(p)); toRemove.forEach(p -> propertySources.remove(p.getName())); }