當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。