当前位置: 首页>>代码示例>>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;未经允许,请勿转载。