當前位置: 首頁>>代碼示例>>Java>>正文


Java MutablePropertySources.remove方法代碼示例

本文整理匯總了Java中org.springframework.core.env.MutablePropertySources.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java MutablePropertySources.remove方法的具體用法?Java MutablePropertySources.remove怎麽用?Java MutablePropertySources.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.core.env.MutablePropertySources的用法示例。


在下文中一共展示了MutablePropertySources.remove方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: finishAndRelocate

import org.springframework.core.env.MutablePropertySources; //導入方法依賴的package包/類
public static void finishAndRelocate(MutablePropertySources propertySources) {
	String name = APPLICATION_CONFIGURATION_PROPERTY_SOURCE_NAME;
	ConfigurationPropertySources removed = (ConfigurationPropertySources) propertySources
			.get(name);
	if (removed != null) {
		for (PropertySource<?> propertySource : removed.sources) {
			if (propertySource instanceof EnumerableCompositePropertySource) {
				EnumerableCompositePropertySource composite = (EnumerableCompositePropertySource) propertySource;
				for (PropertySource<?> nested : composite.getSource()) {
					propertySources.addAfter(name, nested);
					name = nested.getName();
				}
			}
			else {
				propertySources.addAfter(name, propertySource);
			}
		}
		propertySources.remove(APPLICATION_CONFIGURATION_PROPERTY_SOURCE_NAME);
	}
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:21,代碼來源:ConfigFileApplicationListener.java

示例2: removeAllPropertySources

import org.springframework.core.env.MutablePropertySources; //導入方法依賴的package包/類
private void removeAllPropertySources(MutablePropertySources propertySources) {
	Set<String> names = new HashSet<String>();
	for (PropertySource<?> propertySource : propertySources) {
		names.add(propertySource.getName());
	}
	for (String name : names) {
		propertySources.remove(name);
	}
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:10,代碼來源:SpringApplication.java

示例3: addInlinedPropertiesToEnvironmentWithEmptyProperty

import org.springframework.core.env.MutablePropertySources; //導入方法依賴的package包/類
/**
 * @since 4.1.5
 */
@Test
@SuppressWarnings("rawtypes")
public void addInlinedPropertiesToEnvironmentWithEmptyProperty() {
	ConfigurableEnvironment environment = new MockEnvironment();
	MutablePropertySources propertySources = environment.getPropertySources();
	propertySources.remove(MockPropertySource.MOCK_PROPERTIES_PROPERTY_SOURCE_NAME);
	assertEquals(0, propertySources.size());
	addInlinedPropertiesToEnvironment(environment, new String[] { "  " });
	assertEquals(1, propertySources.size());
	assertEquals(0, ((Map) propertySources.iterator().next().getSource()).size());
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:15,代碼來源:TestPropertySourceUtilsTests.java

示例4: removeSystemProperties

import org.springframework.core.env.MutablePropertySources; //導入方法依賴的package包/類
/**
 * Strict tests need a known set of properties so we remove system items which may be
 * environment specific.
 */
private void removeSystemProperties() {
	MutablePropertySources sources = this.context.getEnvironment()
			.getPropertySources();
	sources.remove("systemProperties");
	sources.remove("systemEnvironment");
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:11,代碼來源:EnableConfigurationPropertiesTests.java


注:本文中的org.springframework.core.env.MutablePropertySources.remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。