当前位置: 首页>>代码示例>>Java>>正文


Java PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME属性代码示例

本文整理汇总了Java中org.springframework.context.support.PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME属性的典型用法代码示例。如果您正苦于以下问题:Java PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME属性的具体用法?Java PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME怎么用?Java PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.springframework.context.support.PropertySourcesPlaceholderConfigurer的用法示例。


在下文中一共展示了PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mergePropertySource

protected void mergePropertySource() throws Exception {
	if (this.environment != null) {
		this.addLast(new PropertySource<Environment>(PropertySourcesPlaceholderConfigurer.ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME, this.environment) {
			public String getProperty(String key) {
				return this.source.getProperty(key);
			}
		});
	} else {
		logger.warn("The injected environment was null!");
	}
	if (this.locations != null && this.locations.length > 0) {
		Properties localProperties = new Properties();
		loadProperties(localProperties);
		PropertySource<?> localPropertySource = new PropertiesPropertySource(PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME, localProperties);
		if (this.localOverride) {
			this.addFirst(localPropertySource);
		} else {
			this.addLast(localPropertySource);
		}
	}
}
 
开发者ID:penggle,项目名称:xproject,代码行数:21,代码来源:GlobalPropertySources.java

示例2: postProcessBeanFactory

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	if (this.propertySources == null) {
		this.propertySources = new MutablePropertySources();
		if (this.environment != null) {
			this.propertySources.addLast(
					new PropertySource<Environment>(ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME, this.environment) {
						@Override
						public String getProperty(String key) {
							return this.source.getProperty(key);
						}
					});
		}
		PropertySource<?> localPropertySource = new PropertySource<Configuration>(
				PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME, configuration) {
			@Override
			public Object getProperty(String name) {
				if (name != null && name.indexOf("?:") > 0) {
					name = name.substring(0, name.indexOf("?:"));
				}
				return this.source.getProperty(name);
			}
		};
		propertySources.addFirst(localPropertySource);
	}

	processProperties(beanFactory, new PropertySourcesPropertyResolver(this.propertySources));
	this.appliedPropertySources = this.propertySources;
}
 
开发者ID:xiangxik,项目名称:java-platform,代码行数:29,代码来源:ConfigurationPropertySourcesPlaceholderConfigurer.java


注:本文中的org.springframework.context.support.PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。