|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.core.io.DefaultResourceLoader
org.springframework.context.support.AbstractApplicationContext
org.springframework.context.support.AbstractRefreshableApplicationContext
org.springframework.config.java.context.AbstractAnnotationApplicationContext
public abstract class AbstractAnnotationApplicationContext
Convenient superclass for ApplicationContext implementations that read bean definitions from class bytecode.
This class registers each bean definition with the DefaultListableBeanFactory superclass, and relies on the latter's implementation of the BeanFactory interface. It supports singletons, prototypes, and references to both kinds of bean.
DefaultListableBeanFactory
Field Summary |
---|
Fields inherited from class org.springframework.context.support.AbstractApplicationContext |
---|
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME |
Fields inherited from interface org.springframework.beans.factory.BeanFactory |
---|
FACTORY_BEAN_PREFIX |
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 | |
---|---|
AbstractAnnotationApplicationContext()
|
|
AbstractAnnotationApplicationContext(org.springframework.context.ApplicationContext parent)
|
Method Summary | |
---|---|
protected boolean |
containsConfiguration(java.lang.Class<?> clazz)
Discriminator between configuration and non-configuration classes. |
protected AbstractClassScanningBeanDefinitionReader |
createAnnotationBeanDefinitionReader(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
|
protected java.lang.Class[] |
getConfigClasses()
Return an array of Class objects which act as definition files for a spring context. |
protected java.lang.String[] |
getConfigLocations()
Return an array of resource locations, referring to the class bean definition files that this context should be built with. |
protected org.springframework.core.io.Resource[] |
getConfigResources()
Return an array of Resource objects, referring to the class bean definition files that this context should be built with. |
protected void |
loadBeanDefinitions(AbstractClassScanningBeanDefinitionReader reader)
Load bean definitions with the given AbstractAnnotationBeanDefinitionReader. |
protected void |
loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
|
protected int |
loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory,
java.lang.Class... configClasses)
Load bean definitions from configuration classes. |
protected void |
registerDefaultPostProcessors()
Register the default post processors used for parsing Spring classes. |
Methods inherited from class org.springframework.context.support.AbstractRefreshableApplicationContext |
---|
closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, refreshBeanFactory |
Methods inherited from class org.springframework.context.support.AbstractApplicationContext |
---|
addApplicationListener, addBeanFactoryPostProcessor, addListener, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, destroyBeans, doClose, getAliases, getApplicationListeners, getAutowireCapableBeanFactory, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getDisplayName, getInternalParentBeanFactory, getInternalParentMessageSource, getLifecycleBeans, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResourcePatternResolver, getResources, getStartupDate, getType, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, onClose, onRefresh, postProcessBeanFactory, publishEvent, refresh, registerShutdownHook, setDisplayName, 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 |
Constructor Detail |
---|
public AbstractAnnotationApplicationContext()
public AbstractAnnotationApplicationContext(org.springframework.context.ApplicationContext parent)
Method Detail |
---|
protected void registerDefaultPostProcessors()
protected void loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory) throws java.io.IOException, org.springframework.beans.BeansException
loadBeanDefinitions
in class org.springframework.context.support.AbstractRefreshableApplicationContext
java.io.IOException
org.springframework.beans.BeansException
protected AbstractClassScanningBeanDefinitionReader createAnnotationBeanDefinitionReader(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
protected void loadBeanDefinitions(AbstractClassScanningBeanDefinitionReader reader) throws org.springframework.beans.BeansException, java.io.IOException
The lifecycle of the bean factory is handled by the refreshBeanFactory method; therefore this method is just supposed to load and/or register bean definitions.
Delegates to a ResourcePatternResolver for resolving location patterns into Resource instances.
org.springframework.beans.BeansException
- in case of bean registration errors
java.io.IOException
- if the required class definition isn't foundAbstractRefreshableApplicationContext.refreshBeanFactory()
,
getConfigLocations()
,
AbstractApplicationContext.getResources(java.lang.String)
,
AbstractApplicationContext.getResourcePatternResolver()
protected int loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory, java.lang.Class... configClasses)
Since Class objects cannot be easily translated into a byte array or InputStream, they have be parsed separately.
configClasses
- protected boolean containsConfiguration(java.lang.Class<?> clazz)
clazz
-
protected org.springframework.core.io.Resource[] getConfigResources()
Default implementation returns null
. Subclasses can
override this to provide pre-built Resource objects rather than location
Strings.
null
if nonegetConfigLocations()
protected java.lang.String[] getConfigLocations()
Default implementation returns null
. Subclasses can
override this to provide a set of resource locations to load bean
definitions from.
null
if noneAbstractApplicationContext.getResources(java.lang.String)
,
AbstractApplicationContext.getResourcePatternResolver()
protected java.lang.Class[] getConfigClasses()
Default implementation returns null
. Subclasses can
override this to provide pre-built Class objects rather than location
Strings or Resources. This class should be mainly use when runtime
generating classes are used (runtime compiled Groovy scripts or ASM
'synthetic' classes).
null
if nonegetConfigLocations()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |