|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -22,15 +22,15 @@ import org.springframework.core.io.ResourceLoader; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Simple interface for bean definition readers. |
|
|
|
* Simple interface for bean definition readers that specifies load methods with |
|
|
|
* Specifies load methods with Resource and String location parameters. |
|
|
|
* {@link Resource} and {@link String} location parameters. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>Concrete bean definition readers can of course add additional |
|
|
|
* <p>Concrete bean definition readers can of course add additional |
|
|
|
* load and register methods for bean definitions, specific to |
|
|
|
* load and register methods for bean definitions, specific to |
|
|
|
* their bean definition format. |
|
|
|
* their bean definition format. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>Note that a bean definition reader does not have to implement |
|
|
|
* <p>Note that a bean definition reader does not have to implement |
|
|
|
* this interface. It only serves as suggestion for bean definition |
|
|
|
* this interface. It only serves as a suggestion for bean definition |
|
|
|
* readers that want to follow standard naming conventions. |
|
|
|
* readers that want to follow standard naming conventions. |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Juergen Hoeller |
|
|
|
* @author Juergen Hoeller |
|
|
|
@ -41,14 +41,14 @@ public interface BeanDefinitionReader { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the bean factory to register the bean definitions with. |
|
|
|
* Return the bean factory to register the bean definitions with. |
|
|
|
* <p>The factory is exposed through the BeanDefinitionRegistry interface, |
|
|
|
* <p>The factory is exposed through the {@link BeanDefinitionRegistry} interface, |
|
|
|
* encapsulating the methods that are relevant for bean definition handling. |
|
|
|
* encapsulating the methods that are relevant for bean definition handling. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
BeanDefinitionRegistry getRegistry(); |
|
|
|
BeanDefinitionRegistry getRegistry(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the resource loader to use for resource locations. |
|
|
|
* Return the {@link ResourceLoader} to use for resource locations. |
|
|
|
* Can be checked for the <b>ResourcePatternResolver</b> interface and cast |
|
|
|
* <p>Can be checked for the {@code ResourcePatternResolver} interface and cast |
|
|
|
* accordingly, for loading multiple resources for a given resource pattern. |
|
|
|
* accordingly, for loading multiple resources for a given resource pattern. |
|
|
|
* <p>A {@code null} return value suggests that absolute resource loading |
|
|
|
* <p>A {@code null} return value suggests that absolute resource loading |
|
|
|
* is not available for this bean definition reader. |
|
|
|
* is not available for this bean definition reader. |
|
|
|
@ -56,10 +56,10 @@ public interface BeanDefinitionReader { |
|
|
|
* from within a bean definition resource, for example via the "import" |
|
|
|
* from within a bean definition resource, for example via the "import" |
|
|
|
* tag in XML bean definitions. It is recommended, however, to apply |
|
|
|
* tag in XML bean definitions. It is recommended, however, to apply |
|
|
|
* such imports relative to the defining resource; only explicit full |
|
|
|
* such imports relative to the defining resource; only explicit full |
|
|
|
* resource locations will trigger absolute resource loading. |
|
|
|
* resource locations will trigger absolute path based resource loading. |
|
|
|
* <p>There is also a {@code loadBeanDefinitions(String)} method available, |
|
|
|
* <p>There is also a {@code loadBeanDefinitions(String)} method available, |
|
|
|
* for loading bean definitions from a resource location (or location pattern). |
|
|
|
* for loading bean definitions from a resource location (or location pattern). |
|
|
|
* This is a convenience to avoid explicit ResourceLoader handling. |
|
|
|
* This is a convenience to avoid explicit {@code ResourceLoader} handling. |
|
|
|
* @see #loadBeanDefinitions(String) |
|
|
|
* @see #loadBeanDefinitions(String) |
|
|
|
* @see org.springframework.core.io.support.ResourcePatternResolver |
|
|
|
* @see org.springframework.core.io.support.ResourcePatternResolver |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -70,13 +70,13 @@ public interface BeanDefinitionReader { |
|
|
|
* Return the class loader to use for bean classes. |
|
|
|
* Return the class loader to use for bean classes. |
|
|
|
* <p>{@code null} suggests to not load bean classes eagerly |
|
|
|
* <p>{@code null} suggests to not load bean classes eagerly |
|
|
|
* but rather to just register bean definitions with class names, |
|
|
|
* but rather to just register bean definitions with class names, |
|
|
|
* with the corresponding Classes to be resolved later (or never). |
|
|
|
* with the corresponding classes to be resolved later (or never). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
ClassLoader getBeanClassLoader(); |
|
|
|
ClassLoader getBeanClassLoader(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the BeanNameGenerator to use for anonymous beans |
|
|
|
* Return the {@link BeanNameGenerator} to use for anonymous beans |
|
|
|
* (without explicit bean name specified). |
|
|
|
* (without explicit bean name specified). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
BeanNameGenerator getBeanNameGenerator(); |
|
|
|
BeanNameGenerator getBeanNameGenerator(); |
|
|
|
@ -101,9 +101,10 @@ public interface BeanDefinitionReader { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Load bean definitions from the specified resource location. |
|
|
|
* Load bean definitions from the specified resource location. |
|
|
|
* <p>The location can also be a location pattern, provided that the |
|
|
|
* <p>The location can also be a location pattern, provided that the |
|
|
|
* ResourceLoader of this bean definition reader is a ResourcePatternResolver. |
|
|
|
* {@link ResourceLoader} of this bean definition reader is a |
|
|
|
* @param location the resource location, to be loaded with the ResourceLoader |
|
|
|
* {@code ResourcePatternResolver}. |
|
|
|
* (or ResourcePatternResolver) of this bean definition reader |
|
|
|
* @param location the resource location, to be loaded with the {@code ResourceLoader} |
|
|
|
|
|
|
|
* (or {@code ResourcePatternResolver}) of this bean definition reader |
|
|
|
* @return the number of bean definitions found |
|
|
|
* @return the number of bean definitions found |
|
|
|
* @throws BeanDefinitionStoreException in case of loading or parsing errors |
|
|
|
* @throws BeanDefinitionStoreException in case of loading or parsing errors |
|
|
|
* @see #getResourceLoader() |
|
|
|
* @see #getResourceLoader() |
|
|
|
@ -114,8 +115,8 @@ public interface BeanDefinitionReader { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Load bean definitions from the specified resource locations. |
|
|
|
* Load bean definitions from the specified resource locations. |
|
|
|
* @param locations the resource locations, to be loaded with the ResourceLoader |
|
|
|
* @param locations the resource locations, to be loaded with the {@code ResourceLoader} |
|
|
|
* (or ResourcePatternResolver) of this bean definition reader |
|
|
|
* (or {@code ResourcePatternResolver}) of this bean definition reader |
|
|
|
* @return the number of bean definitions found |
|
|
|
* @return the number of bean definitions found |
|
|
|
* @throws BeanDefinitionStoreException in case of loading or parsing errors |
|
|
|
* @throws BeanDefinitionStoreException in case of loading or parsing errors |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|