本文整理汇总了Java中org.springframework.core.io.support.PropertiesLoaderSupport类的典型用法代码示例。如果您正苦于以下问题:Java PropertiesLoaderSupport类的具体用法?Java PropertiesLoaderSupport怎么用?Java PropertiesLoaderSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertiesLoaderSupport类属于org.springframework.core.io.support包,在下文中一共展示了PropertiesLoaderSupport类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: create
import org.springframework.core.io.support.PropertiesLoaderSupport; //导入依赖的package包/类
/**
* Creates an instance of a {@code TidaServer}, which is completely
* auto-wired according to the configuration.
*
* @param properties
* properties to be set for the configuration
*
* @return the created {@code TidaServer} instance
*/
public static TidaServer create(final Properties properties) {
final List<PropertiesLoaderSupport> holders;
if (properties == null) {
holders = null;
} else {
holders = new ArrayList<PropertiesLoaderSupport>();
// create a propertyHolder for the properties
final SpringPropertyHolder holder = new SpringPropertyHolder();
holder.setProperties(properties);
holder.setLocalOverride(true);
holder.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_NEVER);
holder.setOtherHolderOverride(false);
// add the propertyHolder
holders.add(holder);
}
// create the instance
final ConfigurationCoreSettings settings = ConfigurationCoreSettings
.loadCoreSettings("sbconfigurator-core.xml", TidaConfig.class,
holders, null);
return settings.getConfiguration().getModule("tidaServer");
}
开发者ID:pmeisen,项目名称:dis-timeintervaldataanalyzer,代码行数:35,代码来源:TidaServer.java
示例2: createPropertiesList
import org.springframework.core.io.support.PropertiesLoaderSupport; //导入依赖的package包/类
/**
* Creates the list of the properties to be used within the configuration
* from the outer world.
*
* @param element
* the parent element which contains all the properties
* @param parserContext
* the <code>ParserContext</code>
*
* @return the <code>List</code> containing the beans with properties
*/
protected List<?> createPropertiesList(final Element element,
final ParserContext parserContext) {
final List<Element> propEls = DomUtils.getChildElementsByTagName(
element, XML_ELEMENT_PROPERTIES);
// create the list
final ManagedList<Object> list = new ManagedList<Object>(propEls.size());
list.setSource(parserContext.extractSource(element));
list.setElementTypeName(PropertiesLoaderSupport.class.getName());
list.setMergeEnabled(false);
for (final Element propEl : propEls) {
final String loadId = propEl.getAttribute(XML_ATTRIBUTE_LOADID);
final RuntimeBeanReference ref = new RuntimeBeanReference(loadId);
ref.setSource(parserContext.extractSource(propEl));
list.add(ref);
}
return list;
}
开发者ID:pmeisen,项目名称:gen-sbconfigurator,代码行数:34,代码来源:ConfigParser.java
示例3: getOtherProperties
import org.springframework.core.io.support.PropertiesLoaderSupport; //导入依赖的package包/类
/**
* Gets all the properties of the other defined
* <code>SpringPropertyHolder</code> instances, whereby the definition-order
* matters concerning the overriding of properties, i.e. the latter
* definition overrides the earlier (if the same property is defined several
* times).
*
* @return the properties defined by the other
* <code>SpringPropertyHolder</code> instances
*
* @throws IOException
* if a file resource is defined but cannot be read or accessed
*/
protected Properties getOtherProperties() throws IOException {
final Properties result = new Properties();
for (final PropertiesLoaderSupport propertyHolder : propertyHolders) {
final Properties properties;
if (propertyHolder instanceof SpringPropertyHolder) {
final SpringPropertyHolder sph = ((SpringPropertyHolder) propertyHolder);
properties = sph.getProperties(false);
} else {
properties = PropertiesAccess.getProperties(propertyHolder);
}
CollectionUtils.mergePropertiesIntoMap(properties, result);
}
return result;
}
开发者ID:pmeisen,项目名称:gen-sbconfigurator,代码行数:32,代码来源:SpringPropertyHolder.java
示例4: testPlaceHolderInSelector
import org.springframework.core.io.support.PropertiesLoaderSupport; //导入依赖的package包/类
/**
* Tests the usage of a placeholder within the selector
*
* @throws IOException
* if the properties cannot be read
*/
@Test
public void testPlaceHolderInSelector() throws IOException {
// check that there is onle ony defined
assertEquals(1, corePropertyHolder.getOtherPropertyHolder().size());
// get the one defined in the file
final PropertiesLoaderSupport propertyHolder = corePropertyHolder
.getOtherPropertyHolder().get(0);
assertTrue(propertyHolder instanceof SpringPropertyHolder);
final SpringPropertyHolder innerHolder = (SpringPropertyHolder) propertyHolder;
assertEquals(false, innerHolder.isOtherHolderOverride());
assertEquals(false, innerHolder.isLocalOverride());
assertEquals(
PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE,
innerHolder.getSystemPropertiesMode());
assertEquals(
"net/meisen/general/sbconfigurator/config/placeholder/loader/sampleBeansToBeLoaded.xml",
innerHolder.getProperties().get(
"sbconfigurator.loader.selector"));
assertEquals(
"net/meisen/general/sbconfigurator/config/placeholder/loader/sampleBeansToBeLoaded.xml",
corePropertyHolder.getProperties().get(
"sbconfigurator.loader.selector"));
// check if the configuration was able to load the
assertNotNull(configuration.getModule("dateModule"));
}
开发者ID:pmeisen,项目名称:gen-sbconfigurator,代码行数:36,代码来源:TestPlaceholderInSelectorSimple.java
示例5: loadCoreSettings
import org.springframework.core.io.support.PropertiesLoaderSupport; //导入依赖的package包/类
/**
* Method to load the <code>ConfigurationCoreSettings</code> and all the
* other modules used by the <code>CoreSettings</code>. Additionally some
* other modules (beans) can be injected via the <code>injections</code>.
*
* @param coreSettingsContext
* the name of the context file to load the
* <code>ConfigurationCoreSettings</code> from
* @param clazz
* using the <code>coreSettingsContext</code> of the specified
* class
* @param properties
* properties to be used within the configuration, can be
* <code>null</code>
* @param injections
* additional injections to be added, can be <code>null</code>
*
* @return the loaded <code>ConfigurationCoreSettings</code>
*/
public static ConfigurationCoreSettings loadCoreSettings(
final String coreSettingsContext, final Class<?> clazz,
final List<PropertiesLoaderSupport> properties,
final Map<String, Object> injections) {
final String fCoreSettingsContext = coreSettingsContext == null ? ConfigurationCoreSettings.coreSettingsContext
: coreSettingsContext;
final Class<?> fClazz = clazz == null ? ConfigurationCoreSettings.class
: clazz;
// create the factory with auto-wiring this will bring up the
// core-system
final DefaultListableBeanFactory factory = SpringHelper
.createBeanFactory(true, true);
if (properties != null) {
for (final PropertiesLoaderSupport p : properties) {
factory.registerSingleton("PROPERTIES_"
+ UUID.randomUUID().toString(), p);
}
}
// create the reader
final XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(
factory);
// load the core resource into the reader
final Resource coreRes = new ClassPathResource(fCoreSettingsContext,
fClazz);
reader.loadBeanDefinitions(coreRes);
// get the bean
final ConfigurationCoreSettings settings = (ConfigurationCoreSettings) factory
.getBean(IConfiguration.coreSettingsId);
if (LOG.isTraceEnabled()) {
LOG.trace("The coreSettings are loaded and auto-wired.");
}
// trigger the loading of the Configuration
if (injections == null) {
settings.getConfiguration().loadConfiguration(
new HashMap<String, Object>());
} else {
settings.getConfiguration().loadConfiguration(injections);
}
return settings;
}
开发者ID:pmeisen,项目名称:gen-sbconfigurator,代码行数:68,代码来源:ConfigurationCoreSettings.java
示例6: getProperties
import org.springframework.core.io.support.PropertiesLoaderSupport; //导入依赖的package包/类
/**
* Get all the {@code PropertiesLoader} defined for the
* {@code ConfigurationHolder} from outside.
*
* @return the list with all the {@code PropertiesLoader}
*
* @see PropertiesLoaderSupport
*/
public List<PropertiesLoaderSupport> getProperties() {
return properties;
}
开发者ID:pmeisen,项目名称:gen-sbconfigurator,代码行数:12,代码来源:ConfigurationHolder.java
示例7: setProperties
import org.springframework.core.io.support.PropertiesLoaderSupport; //导入依赖的package包/类
/**
* Sets the list with teh {@code PropertiesLoader} defined from outside.
*
* @param properties
* the list with all the {@code PropertiesLoader}
*
* @see PropertiesLoaderSupport
*/
public void setProperties(final List<PropertiesLoaderSupport> properties) {
this.properties = properties;
}
开发者ID:pmeisen,项目名称:gen-sbconfigurator,代码行数:12,代码来源:ConfigurationHolder.java
示例8: getOtherPropertyHolder
import org.springframework.core.io.support.PropertiesLoaderSupport; //导入依赖的package包/类
/**
* Gets all the other {@code PropertyHolder} instances used by {@code this}.
*
* @return the other {@code PropertyHolder} instances
*/
public List<PropertiesLoaderSupport> getOtherPropertyHolder() {
return Collections.unmodifiableList(propertyHolders);
}
开发者ID:pmeisen,项目名称:gen-sbconfigurator,代码行数:9,代码来源:SpringPropertyHolder.java
注:本文中的org.springframework.core.io.support.PropertiesLoaderSupport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论