public interface BeanLocator
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
Modifier and Type | Method and Description |
---|---|
boolean |
containsBean(java.lang.String name)
Whether a bean with the given name is present.
|
<T> T |
get(java.lang.Class<T> beanType)
Returns the bean instance that matches the given object type.
|
<T> T |
get(java.lang.String name)
Return an instance of the specified bean.
|
<T> T |
get(java.lang.String name,
java.lang.Class<T> beanType)
Returns an instance of the specified bean.
|
<T> java.util.Map<java.lang.String,T> |
getAll(java.lang.Class<T> beanType)
Returns the bean instances that match the given object type (including
subclasses).
|
<T> T |
getPrototype(java.lang.String name,
java.lang.Object... args)
Returns an instance of prototype bean, specifying explicit constructor arguments.
|
static final java.lang.String NAME
<T> T get(java.lang.Class<T> beanType)
NAME
, this name is used to look up the
bean to improve performance.beanType
- type the bean must match; can be an interface or superclass. null
is disallowed.<T> T get(java.lang.String name)
name
- the name of the bean to retrieveBeanFactory.getBean(java.lang.String)
<T> T get(java.lang.String name, @Nullable java.lang.Class<T> beanType)
name
- the name of the bean to retrievebeanType
- type the bean must match. Can be an interface or superclass of the actual class, or null
for any match. For example, if the value is Object.class, this method will succeed whatever the class of the
returned instance.<T> T getPrototype(java.lang.String name, java.lang.Object... args)
name
- the name of the bean to retrieveargs
- constructor arguments<T> java.util.Map<java.lang.String,T> getAll(java.lang.Class<T> beanType)
The Map returned by this method should always return bean names and corresponding bean instances in the order of definition in the backend configuration, as far as possible.
beanType
- the class or interface to match, or null
for all concrete beansboolean containsBean(java.lang.String name)