org.broadleafcommerce.common.extensibility.context
Class MergeFileSystemXMLApplicationContext

java.lang.Object
  extended by org.springframework.core.io.DefaultResourceLoader
      extended by org.springframework.context.support.AbstractApplicationContext
          extended by org.springframework.context.support.AbstractRefreshableApplicationContext
              extended by org.springframework.context.support.AbstractRefreshableConfigApplicationContext
                  extended by org.springframework.context.support.AbstractXmlApplicationContext
                      extended by org.broadleafcommerce.common.extensibility.context.MergeFileSystemXMLApplicationContext
All Implemented Interfaces:
Closeable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactory, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.HierarchicalBeanFactory, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.ListableBeanFactory, org.springframework.context.ApplicationContext, org.springframework.context.ApplicationEventPublisher, org.springframework.context.ConfigurableApplicationContext, org.springframework.context.Lifecycle, org.springframework.context.MessageSource, org.springframework.core.env.EnvironmentCapable, org.springframework.core.io.ResourceLoader, org.springframework.core.io.support.ResourcePatternResolver

public class MergeFileSystemXMLApplicationContext
extends org.springframework.context.support.AbstractXmlApplicationContext

Standalone XML application context, taking the locations of one or more source applicationContext xml files and one or more patch xml files.

One or more source files merge together in pure override mode. Source files are merged in the order specified. If a bean id is repeated in a subsequent source file, the subsequent bean definition will always win. This is the same behavior as Spring's default mechanism for merging 1 to N applicationContext files.

Each patch file is merged with the combined source, one patch file at a time. This merge is performed in true merge mode. Therefore, if a bean id is delivered in a patch file with the same id as a bean in the source, the patch will merge with the source. This could result in an override of the class definition for the bean, or additional or changed property elements within the bean definition.

Author:
jfischer

Field Summary
protected  org.springframework.core.io.Resource[] configResources
           
 
Fields inherited from class org.springframework.context.support.AbstractApplicationContext
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME
 
Fields inherited from interface org.springframework.context.ConfigurableApplicationContext
CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME
 
Fields inherited from interface org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX
 
Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIX
 
Fields inherited from interface org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIX
 
Constructor Summary
MergeFileSystemXMLApplicationContext(String[] sourceLocations, String[] patchLocations)
          Create a new MergeClassPathXMLApplicationContext, loading the definitions from the given files.
MergeFileSystemXMLApplicationContext(String[] sourceLocations, String[] patchLocations, org.springframework.context.ApplicationContext parent)
          Create a new MergeClassPathXMLApplicationContext, loading the definitions from the given files.
 
Method Summary
protected  org.springframework.core.io.Resource[] getConfigResources()
           
 
Methods inherited from class org.springframework.context.support.AbstractXmlApplicationContext
initBeanDefinitionReader, loadBeanDefinitions, loadBeanDefinitions, setValidating
 
Methods inherited from class org.springframework.context.support.AbstractRefreshableConfigApplicationContext
afterPropertiesSet, getConfigLocations, getDefaultConfigLocations, resolvePath, setBeanName, setConfigLocation, setConfigLocations, setId
 
Methods inherited from class org.springframework.context.support.AbstractRefreshableApplicationContext
cancelRefresh, closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, hasBeanFactory, refreshBeanFactory, setAllowBeanDefinitionOverriding, setAllowCircularReferences
 
Methods inherited from class org.springframework.context.support.AbstractApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, addListener, close, containsBean, containsBeanDefinition, containsLocalBean, createEnvironment, destroy, destroyBeans, doClose, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getApplicationName, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getEnvironment, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResourcePatternResolver, getResources, getStartupDate, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, initPropertySources, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, obtainFreshBeanFactory, onClose, onRefresh, postProcessBeanFactory, prepareBeanFactory, prepareRefresh, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, setDisplayName, setEnvironment, setParent, start, stop, toString
 
Methods inherited from class org.springframework.core.io.DefaultResourceLoader
getClassLoader, getResource, getResourceByPath, setClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.core.io.ResourceLoader
getClassLoader, getResource
 

Field Detail

configResources

protected org.springframework.core.io.Resource[] configResources
Constructor Detail

MergeFileSystemXMLApplicationContext

public MergeFileSystemXMLApplicationContext(String[] sourceLocations,
                                            String[] patchLocations)
                                     throws org.springframework.beans.BeansException
Create a new MergeClassPathXMLApplicationContext, loading the definitions from the given files. Note, all sourceLocation files will be merged using standard Spring configuration override rules. However, the patch files are fully merged into the result of the sourceLocations simple merge. Patch merges are first executed according to beans with the same id. Subsequent merges within a bean are executed against tagnames - ignoring any further id attributes.

Parameters:
sourceLocations - array of absolute file system paths for the source application context files
patchLocations - array of absolute file system paths for the patch application context files
Throws:
org.springframework.beans.BeansException

MergeFileSystemXMLApplicationContext

public MergeFileSystemXMLApplicationContext(String[] sourceLocations,
                                            String[] patchLocations,
                                            org.springframework.context.ApplicationContext parent)
                                     throws org.springframework.beans.BeansException
Create a new MergeClassPathXMLApplicationContext, loading the definitions from the given files. Note, all sourceLocation files will be merged using standard Spring configuration override rules. However, the patch files are fully merged into the result of the sourceLocations simple merge. Patch merges are first executed according to beans with the same id. Subsequent merges within a bean are executed against tagnames - ignoring any further id attributes.

Parameters:
sourceLocations - array of absolute file system paths for the source application context files
patchLocations - array of absolute file system paths for the patch application context files
parent - the parent context
Throws:
org.springframework.beans.BeansException
Method Detail

getConfigResources

protected org.springframework.core.io.Resource[] getConfigResources()
Overrides:
getConfigResources in class org.springframework.context.support.AbstractXmlApplicationContext


Copyright © 2013. All Rights Reserved.