public abstract class AbstractApplicationContextFactory extends java.lang.Object implements ApplicationContextFactory, org.springframework.context.ApplicationContextAware
ApplicationContextFactory implementation that takes a parent context and a path to the context to create.
When createApplicationContext method is called, the child ApplicationContext will be returned. The child
context is not re-created every time it is requested, it is lazily initialized and cached. Clients should ensure that
it is closed when it is no longer needed. If a path is not set, the parent will always be returned.| Constructor and Description |
|---|
AbstractApplicationContextFactory(java.lang.Object... resource)
Create a factory instance with the resource specified.
|
| Modifier and Type | Method and Description |
|---|---|
org.springframework.context.ConfigurableApplicationContext |
createApplicationContext()
Creates an
ApplicationContext from the provided path. |
protected abstract org.springframework.context.ConfigurableApplicationContext |
createApplicationContext(org.springframework.context.ConfigurableApplicationContext parent,
java.lang.Object... resources) |
boolean |
equals(java.lang.Object obj) |
protected java.util.Collection<java.lang.Class<? extends org.springframework.beans.factory.config.BeanFactoryPostProcessor>> |
getBeanFactoryPostProcessorClasses()
Protected access to the list of bean factory post processor classes that should be copied over to the context
from the parent.
|
int |
hashCode() |
protected boolean |
isCopyConfiguration()
Protected access for subclasses to the flag determining whether configuration should be copied from parent
context.
|
protected void |
prepareBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory parent,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
Extension point for special subclasses that want to do more complex things with the bean factory prior to
refresh.
|
protected void |
prepareContext(org.springframework.context.ConfigurableApplicationContext parent,
org.springframework.context.ConfigurableApplicationContext context)
Extension point for special subclasses that want to do more complex things with the context prior to refresh.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Setter for the parent application context.
|
void |
setBeanFactoryPostProcessorClasses(java.lang.Class<? extends org.springframework.beans.factory.config.BeanFactoryPostProcessor>[] beanFactoryPostProcessorClasses)
Determines which bean factory post processors (like property placeholders) should be copied from the parent
context.
|
void |
setBeanPostProcessorExcludeClasses(java.lang.Class<?>[] beanPostProcessorExcludeClasses)
Determines by exclusion which bean post processors should be copied from the parent context.
|
void |
setCopyConfiguration(boolean copyConfiguration)
Flag to indicate that configuration such as bean post processors and custom editors should be copied from the
parent context.
|
java.lang.String |
toString() |
public AbstractApplicationContextFactory(java.lang.Object... resource)
public void setCopyConfiguration(boolean copyConfiguration)
copyConfiguration - the flag value to setprotected final boolean isCopyConfiguration()
public void setBeanFactoryPostProcessorClasses(java.lang.Class<? extends org.springframework.beans.factory.config.BeanFactoryPostProcessor>[] beanFactoryPostProcessorClasses)
PropertyPlaceholderConfigurer and CustomEditorConfigurer.beanFactoryPostProcessorClasses - array of post processor types to be copiedpublic void setBeanPostProcessorExcludeClasses(java.lang.Class<?>[] beanPostProcessorExcludeClasses)
BeanFactoryAware (so any post processors that have a reference to the parent bean factory are not copied
into the child). Note that these classes do not themselves have to be BeanPostProcessor implementations
or sub-interfaces.beanPostProcessorExcludeClasses - the classes to setprotected final java.util.Collection<java.lang.Class<? extends org.springframework.beans.factory.config.BeanFactoryPostProcessor>> getBeanFactoryPostProcessorClasses()
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)public org.springframework.context.ConfigurableApplicationContext createApplicationContext()
ApplicationContext from the provided path.createApplicationContext in interface ApplicationContextFactoryApplicationContextFactory.createApplicationContext()protected abstract org.springframework.context.ConfigurableApplicationContext createApplicationContext(org.springframework.context.ConfigurableApplicationContext parent,
java.lang.Object... resources)
protected void prepareContext(org.springframework.context.ConfigurableApplicationContext parent,
org.springframework.context.ConfigurableApplicationContext context)
parent - the parent for the new application contextcontext - the new application context before it is refreshed, but after bean factory is initializedsetBeanFactoryPostProcessorClasses(Class[])protected void prepareBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory parent,
org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
flag set.parent - the parent bean factory for the new context (will never be null)beanFactory - the new bean factory before bean definitions are loadedsetCopyConfiguration(boolean),
DefaultListableBeanFactory.copyConfigurationFrom(ConfigurableBeanFactory)public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object