/** * Return a merged Properties instance containing both the * loaded properties and properties set on this FactoryBean. */ protected Properties mergeProperties() throws IOException { Properties result = new Properties(); if (this.localOverride) { // Load properties from file upfront, to let local properties override. loadProperties(result); } if (this.localProperties != null) { for (Properties localProp : this.localProperties) { CollectionUtils.mergePropertiesIntoMap(localProp, result); } } if (!this.localOverride) { // Load properties from file afterwards, to let those properties override. loadProperties(result); } return result; }
public ApplicationContext createApplicatonContext(FlowDefinition processDefinition, Map<String, ? extends Object> projectProperties, final ApplicationContext parent) { Resource[] configResources = null; ClassLoader classLoader = this.getClass().getClassLoader(); ClassLoader originalClassLoader = ClassUtils.overrideThreadContextClassLoader(classLoader); try { Assert.notNull(processDefinition); Assert.notNull(processDefinition.getProcessingConfiguration()); Resource processContext = new InputStreamResource(processDefinition.getProcessingConfiguration()); configResources = createResources(processContext, originalClassLoader); } finally { if (originalClassLoader != null) { Thread.currentThread().setContextClassLoader(originalClassLoader); } } ProcessResourceLocator processResourceLocator = new ProcessResourceLocator(processDefinition); externalResourceLocators.add(processResourceLocator); Properties properties = convertProperties(projectProperties); AbstractRefreshableApplicationContext applicationContext = new ProcessXmlApplicationContext(configResources, externalResourceLocators); // BeanPostProcessor applicationContext.setParent(parent); for (BeanFactoryPostProcessor postProcessor : postProcessors) { if (postProcessor instanceof PropertiesLoaderSupport) { ((PropertiesLoaderSupport) postProcessor).setProperties(properties); } applicationContext.addBeanFactoryPostProcessor(postProcessor); } applicationContext.refresh(); return applicationContext; }
/** * Return a merged Properties instance containing both the * loaded properties and properties set on this FactoryBean. */ protected Properties mergeProperties() throws IOException { Properties result = new Properties(); if (this.localOverride) { // Load properties from file upfront, to let local properties override. loadProperties(result); } if (this.localProperties != null) { for (Properties localProp : this.localProperties) { CollectionUtils.mergePropertiesIntoMap(localProp, result); } } if (!this.localOverride) { // Load properties from file afterwards, to let those properties override. loadProperties(result); } return result; }
/** * Return a merged Properties instance containing both the * loaded properties and properties set on this FactoryBean. */ protected Properties mergeProperties() throws IOException { Properties result = new Properties(); if (this.localOverride) { // Load properties from file upfront, to let local properties override. loadProperties(result); } if (this.localProperties != null) { for (Properties localProp : this.localProperties) { CollectionUtils.mergePropertiesIntoMap(localProp, result); } } if (!this.localOverride) { // Load properties from file afterwards, to let those properties override. loadProperties(result); } return result; }
/** * Return a merged Properties instance containing both the * loaded properties and properties set on this FactoryBean. */ protected Properties mergeProperties() throws IOException { Properties result = new Properties(); if (this.localOverride) { // Load properties from file upfront, to let local properties override. loadProperties(result); } if (this.localProperties != null) { for (Properties localProp : this.localProperties) { CollectionUtils.mergePropertiesIntoMap(localProp, result); } } if (!this.localOverride) { // Load properties from file afterwards, to let those properties override. loadProperties(result); } return result; }
/** * Return a merged Properties instance containing both the * loaded properties and properties set on this FactoryBean. */ protected Properties mergeProperties() throws IOException { Properties result = new Properties(); if (this.localOverride) { // Load properties from file upfront, to let local properties override. loadProperties(result); } if (this.localProperties != null) { for (Properties localProp : this.localProperties) { CollectionUtils.mergePropertiesIntoMap(localProp, result); } } if (!this.localOverride) { // Load properties from file afterwards, to let those properties override. loadProperties(result); } return result; }
/** * Return a merged Properties instance containing both the * loaded properties and properties set on this FactoryBean. */ protected Properties mergeProperties() throws IOException { Properties result = new Properties(); if (this.localOverride) { // Load properties from file upfront, to let local properties override. loadProperties(result); } if (this.properties != null) { // Use propertyNames enumeration to also catch default properties. for (Enumeration en = this.properties.propertyNames(); en.hasMoreElements();) { String key = (String) en.nextElement(); result.setProperty(key, this.properties.getProperty(key)); } } if (!this.localOverride) { // Load properties from file afterwards, to let those properties override. loadProperties(result); } return result; }