| Method from org.springframework.beans.factory.support.AbstractBeanDefinitionReader Detail: |
public ClassLoader getBeanClassLoader() {
return this.beanClassLoader;
}
|
public final BeanDefinitionRegistry getBeanFactory() {
return this.registry;
}
|
public BeanNameGenerator getBeanNameGenerator() {
return this.beanNameGenerator;
}
|
public final BeanDefinitionRegistry getRegistry() {
return this.registry;
}
|
public ResourceLoader getResourceLoader() {
return this.resourceLoader;
}
|
public int loadBeanDefinitions(Resource[] resources) throws BeanDefinitionStoreException {
Assert.notNull(resources, "Resource array must not be null");
int counter = 0;
for (int i = 0; i < resources.length; i++) {
counter += loadBeanDefinitions(resources[i]);
}
return counter;
}
|
public int loadBeanDefinitions(String location) throws BeanDefinitionStoreException {
return loadBeanDefinitions(location, null);
}
|
public int loadBeanDefinitions(String[] locations) throws BeanDefinitionStoreException {
Assert.notNull(locations, "Location array must not be null");
int counter = 0;
for (int i = 0; i < locations.length; i++) {
counter += loadBeanDefinitions(locations[i]);
}
return counter;
}
|
public int loadBeanDefinitions(String location,
Set actualResources) throws BeanDefinitionStoreException {
ResourceLoader resourceLoader = getResourceLoader();
if (resourceLoader == null) {
throw new BeanDefinitionStoreException(
"Cannot import bean definitions from location [" + location + "]: no ResourceLoader available");
}
if (resourceLoader instanceof ResourcePatternResolver) {
// Resource pattern matching available.
try {
Resource[] resources = ((ResourcePatternResolver) resourceLoader).getResources(location);
int loadCount = loadBeanDefinitions(resources);
if (actualResources != null) {
for (int i = 0; i < resources.length; i++) {
actualResources.add(resources[i]);
}
}
if (logger.isDebugEnabled()) {
logger.debug("Loaded " + loadCount + " bean definitions from location pattern [" + location + "]");
}
return loadCount;
}
catch (IOException ex) {
throw new BeanDefinitionStoreException(
"Could not resolve bean definition resource pattern [" + location + "]", ex);
}
}
else {
// Can only load single resources by absolute URL.
Resource resource = resourceLoader.getResource(location);
int loadCount = loadBeanDefinitions(resource);
if (actualResources != null) {
actualResources.add(resource);
}
if (logger.isDebugEnabled()) {
logger.debug("Loaded " + loadCount + " bean definitions from location [" + location + "]");
}
return loadCount;
}
}
Load bean definitions from the specified resource location.
The location can also be a location pattern, provided that the
ResourceLoader of this bean definition reader is a ResourcePatternResolver. |
public void setBeanClassLoader(ClassLoader beanClassLoader) {
this.beanClassLoader = beanClassLoader;
}
Set the ClassLoader to use for bean classes.
Default is null, which 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). |
public void setBeanNameGenerator(BeanNameGenerator beanNameGenerator) {
this.beanNameGenerator = (beanNameGenerator != null ? beanNameGenerator : new DefaultBeanNameGenerator());
}
|
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
}
Set the ResourceLoader to use for resource locations.
If specifying a ResourcePatternResolver, the bean definition reader
will be capable of resolving resource patterns to Resource arrays.
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. |