public interface BeanLocator
Core interface for locating and discovering Bean instances.
| Modifier and Type | Method and Description |
|---|---|
default <T> Optional<T> |
findBean(Class<T> beanType)
Finds a Bean for the given type.
|
<T> Optional<T> |
findBean(Class<T> beanType,
Qualifier<T> qualifier)
Finds a Bean for the given type and qualifier.
|
default <T> Optional<T> |
findOrInstantiateBean(Class<T> beanType)
Finds a Bean for the given type or attempts to instantiate the given instance.
|
default <T> T |
getBean(Class<T> beanType)
Obtains a Bean for the given type.
|
<T> T |
getBean(Class<T> beanType,
Qualifier<T> qualifier)
Obtains a Bean for the given type and qualifier.
|
<T> Collection<T> |
getBeansOfType(Class<T> beanType)
Get all beans of the given type.
|
<T> Collection<T> |
getBeansOfType(Class<T> beanType,
Qualifier<T> qualifier)
Get all beans of the given type.
|
<T> T |
getProxyTargetBean(Class<T> beanType,
Qualifier<T> qualifier)
Resolves the proxy target for a given bean type.
|
default <T> Stream<T> |
streamOfType(Class<T> beanType)
Obtain a stream of beans of the given type.
|
<T> Stream<T> |
streamOfType(Class<T> beanType,
Qualifier<T> qualifier)
Obtain a stream of beans of the given type.
|
<T> T getBean(Class<T> beanType, Qualifier<T> qualifier)
T - The bean type parameterbeanType - The bean typequalifier - The qualifierNonUniqueBeanException - When multiple possible bean definitions exist
for the given typeQualifiers<T> Optional<T> findBean(Class<T> beanType, Qualifier<T> qualifier)
T - The bean type parameterbeanType - The bean typequalifier - The qualifierOptional that is either empty or containing the specified beanNonUniqueBeanException - When multiple possible bean definitions exist
for the given typeQualifiers<T> Collection<T> getBeansOfType(Class<T> beanType)
T - The bean type parameterbeanType - The bean type<T> Collection<T> getBeansOfType(Class<T> beanType, Qualifier<T> qualifier)
T - The bean type parameterbeanType - The bean typequalifier - The qualifier<T> Stream<T> streamOfType(Class<T> beanType, Qualifier<T> qualifier)
T - The bean concrete typebeanType - The bean typequalifier - The qualifierQualifiers<T> T getProxyTargetBean(Class<T> beanType, Qualifier<T> qualifier)
T - The generic typebeanType - The bean typequalifier - The bean qualifierdefault <T> Stream<T> streamOfType(Class<T> beanType)
T - The bean concrete typebeanType - The bean typedefault <T> T getBean(Class<T> beanType)
T - The bean type parameterbeanType - The bean typeNonUniqueBeanException - When multiple possible bean definitions exist
for the given typedefault <T> Optional<T> findBean(Class<T> beanType)
T - The bean type parameterbeanType - The bean typeOptional that is either empty or containing the specified beanNonUniqueBeanException - When multiple possible bean definitions exist
for the given typedefault <T> Optional<T> findOrInstantiateBean(Class<T> beanType)
T - The bean type parameterbeanType - The bean typeOptional that is either empty or containing the specified bean if it could not
be found or instantiatedNonUniqueBeanException - When multiple possible bean definitions exist
for the given type