|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.core.configuration.support.ClassPathXmlApplicationContextFactory
public class ClassPathXmlApplicationContextFactory
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 Summary | |
---|---|
ClassPathXmlApplicationContextFactory()
Convenient constructor for configuration purposes. |
|
ClassPathXmlApplicationContextFactory(Resource resource)
Create a factory instance with the resource specified. |
Method Summary | |
---|---|
ConfigurableApplicationContext |
createApplicationContext()
Creates an ApplicationContext from the provided path. |
boolean |
equals(Object obj)
|
protected Collection<Class<? extends 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(DefaultListableBeanFactory parent,
DefaultListableBeanFactory beanFactory)
Extension point for special subclasses that want to do more complex things with the bean factory prior to refresh. |
protected void |
prepareContext(ConfigurableApplicationContext parent,
ConfigurableApplicationContext context)
Extension point for special subclasses that want to do more complex things with the context prior to refresh. |
void |
setApplicationContext(ApplicationContext applicationContext)
Setter for the parent application context. |
void |
setBeanFactoryPostProcessorClasses(Class<? extends BeanFactoryPostProcessor>[] beanFactoryPostProcessorClasses)
Determines which bean factory post processors (like property placeholders) should be copied from the parent context. |
void |
setBeanPostProcessorExcludeClasses(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. |
void |
setResource(Resource resource)
Setter for the path to the xml to load to create an ApplicationContext . |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ClassPathXmlApplicationContextFactory()
public ClassPathXmlApplicationContextFactory(Resource resource)
Method Detail |
---|
public void setResource(Resource resource)
ApplicationContext
. Use imports to centralise the configuration
in one file.
resource
- the resource path to the xml to load for the child
context.public void setCopyConfiguration(boolean copyConfiguration)
copyConfiguration
- the flag value to setprotected final boolean isCopyConfiguration()
public void setBeanFactoryPostProcessorClasses(Class<? extends BeanFactoryPostProcessor>[] beanFactoryPostProcessorClasses)
PropertyPlaceholderConfigurer
and CustomEditorConfigurer
.
copyBeanFactoryPostProcessors
- the flag value to setpublic void setBeanPostProcessorExcludeClasses(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 Collection<Class<? extends BeanFactoryPostProcessor>> getBeanFactoryPostProcessorClasses()
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)
public ConfigurableApplicationContext createApplicationContext()
ApplicationContext
from the provided path.
createApplicationContext
in interface ApplicationContextFactory
ApplicationContextFactory.createApplicationContext()
protected void prepareContext(ConfigurableApplicationContext parent, 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(DefaultListableBeanFactory parent, DefaultListableBeanFactory 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 String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |