|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.beans.factory.support.AbstractBeanDefinitionReader
public abstract class AbstractBeanDefinitionReader
Abstract base class for bean definition readers which implement the BeanDefinitionReader interface.
Provides common properties like the bean factory to work on and the class loader to use for loading bean classes.
BeanDefinitionReaderUtils| Field Summary | |
|---|---|
protected Log |
logger
|
| Constructor Summary | |
|---|---|
protected |
AbstractBeanDefinitionReader(BeanDefinitionRegistry beanFactory)
Create a new AbstractBeanDefinitionReader for the given bean factory. |
| Method Summary | |
|---|---|
ClassLoader |
getBeanClassLoader()
Return the class loader to use for bean classes. |
BeanDefinitionRegistry |
getBeanFactory()
Return the bean factory to register the bean definitions with. |
ResourceLoader |
getResourceLoader()
Return the resource loader to use for resource locations. |
int |
loadBeanDefinitions(Resource[] resources)
Load bean definitions from the specified resources. |
int |
loadBeanDefinitions(String location)
Load bean definitions from the specified resource location. |
int |
loadBeanDefinitions(String[] locations)
Load bean definitions from the specified resource locations. |
void |
setBeanClassLoader(ClassLoader beanClassLoader)
Set the ClassLoader to use for bean classes. |
void |
setResourceLoader(ResourceLoader resourceLoader)
Set the ResourceLoader to use for resource locations. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.springframework.beans.factory.support.BeanDefinitionReader |
|---|
loadBeanDefinitions |
| Field Detail |
|---|
protected final Log logger
| Constructor Detail |
|---|
protected AbstractBeanDefinitionReader(BeanDefinitionRegistry beanFactory)
If the passed-in bean factory does not only implement the BeanDefinitionRegistry interface but also the ResourceLoader interface, it will be used as default ResourceLoader as well. This will usually be the case for ApplicationContext implementations.
If given a plain BeanDefinitionRegistry, the default ResourceLoader will be a PathMatchingResourcePatternResolver, also capable of resource pattern resolving through the ResourcePatternResolver interface.
beanFactory - the bean factory to work onsetResourceLoader(org.springframework.core.io.ResourceLoader),
ApplicationContext,
ResourceLoader,
ResourcePatternResolver,
PathMatchingResourcePatternResolver| Method Detail |
|---|
public BeanDefinitionRegistry getBeanFactory()
BeanDefinitionReaderThe factory is exposed through the BeanDefinitionRegistry interface, encapsulating the methods that are relevant for bean definition handling.
getBeanFactory in interface BeanDefinitionReaderpublic void setResourceLoader(ResourceLoader resourceLoader)
Default is PathMatchingResourcePatternResolver, also capable of resource pattern resolving through the ResourcePatternResolver interface.
Setting this to null suggests that absolute resource loading
is not available for this bean definition reader.
public ResourceLoader getResourceLoader()
BeanDefinitionReaderNull suggests that absolute resource loading is not available for this bean definition reader.
This is mainly meant to be used for importing further resources from within a bean definition resource, for example via the "import" tag in XML bean definitions. It is recommended, however, to apply such imports relative to the defining resource; only explicit full resource locations will trigger absolute resource loading.
There is also a loadBeanDefinitions(String) method available,
for loading bean definitions from a resource location (or location pattern).
This is a convenience to avoid explicit ResourceLoader handling.
getResourceLoader in interface BeanDefinitionReaderpublic void setBeanClassLoader(ClassLoader beanClassLoader)
Setting this to null suggests to not load bean classes but just
register bean definitions with class names, for example when just registering
beans in a registry but not actually instantiating them in a factory.
Thread.getContextClassLoader()public ClassLoader getBeanClassLoader()
BeanDefinitionReadernull suggests to not load bean classes but just register bean
definitions with class names, for example when just registering beans in a
registry but not actually instantiating them in a factory.
getBeanClassLoader in interface BeanDefinitionReaderpublic int loadBeanDefinitions(Resource[] resources) throws BeansException
BeanDefinitionReader
loadBeanDefinitions in interface BeanDefinitionReaderresources - the resource descriptors
BeanDefinitionStoreException - in case of loading or parsing errors
BeansExceptionpublic int loadBeanDefinitions(String location) throws BeanDefinitionStoreException
BeanDefinitionReaderThe location can also be a location pattern, provided that the ResourceLoader of this bean definition reader is a ResourcePatternResolver.
loadBeanDefinitions in interface BeanDefinitionReaderlocation - the resource location, to be loaded with the ResourceLoader
(or ResourcePatternResolver) of this bean definition reader
BeanDefinitionStoreException - in case of loading or parsing errorsBeanDefinitionReader.getResourceLoader(),
BeanDefinitionReader.loadBeanDefinitions(org.springframework.core.io.Resource),
BeanDefinitionReader.loadBeanDefinitions(org.springframework.core.io.Resource[])public int loadBeanDefinitions(String[] locations) throws BeansException
BeanDefinitionReader
loadBeanDefinitions in interface BeanDefinitionReaderlocations - the resource locations, to be loaded with the ResourceLoader
(or ResourcePatternResolver) of this bean definition reader
BeanDefinitionStoreException - in case of loading or parsing errors
BeansException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||