public interface BeanDefinitionReader
Concrete bean definition readers can of course add additional load and register methods for bean definitions, specific to their bean definition format.
Note that a bean definition reader does not have to implement this interface. It only serves as suggestion for bean definition readers that want to follow standard naming conventions.
Resource
Modifier and Type | Method and Description |
---|---|
ClassLoader |
getBeanClassLoader()
Return the class loader to use for bean classes.
|
BeanNameGenerator |
getBeanNameGenerator()
Return the BeanNameGenerator to use for anonymous beans
(without explicit bean name specified).
|
BeanDefinitionRegistry |
getRegistry()
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(Resource resource)
Load bean definitions from the specified resource.
|
int |
loadBeanDefinitions(String... locations)
Load bean definitions from the specified resource locations.
|
int |
loadBeanDefinitions(String location)
Load bean definitions from the specified resource location.
|
BeanDefinitionRegistry getRegistry()
The factory is exposed through the BeanDefinitionRegistry interface, encapsulating the methods that are relevant for bean definition handling.
ResourceLoader getResourceLoader()
Null 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.
ClassLoader getBeanClassLoader()
null
suggests to not load bean classes eagerly
but rather to just register bean definitions with class names,
with the corresponding Classes to be resolved later (or never).
BeanNameGenerator getBeanNameGenerator()
int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException
resource
- the resource descriptorBeanDefinitionStoreException
- in case of loading or parsing errorsint loadBeanDefinitions(Resource... resources) throws BeanDefinitionStoreException
resources
- the resource descriptorsBeanDefinitionStoreException
- in case of loading or parsing errorsint loadBeanDefinitions(String location) throws BeanDefinitionStoreException
The location can also be a location pattern, provided that the ResourceLoader of this bean definition reader is a ResourcePatternResolver.
location
- the resource location, to be loaded with the ResourceLoader
(or ResourcePatternResolver) of this bean definition readerBeanDefinitionStoreException
- in case of loading or parsing errorsgetResourceLoader()
,
loadBeanDefinitions(org.springframework.core.io.Resource)
,
loadBeanDefinitions(org.springframework.core.io.Resource[])
int loadBeanDefinitions(String... locations) throws BeanDefinitionStoreException
locations
- the resource locations, to be loaded with the ResourceLoader
(or ResourcePatternResolver) of this bean definition readerBeanDefinitionStoreException
- in case of loading or parsing errors