本文整理匯總了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);
}
}
}
示例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