public class GenericBeanFactoryAccessor
extends java.lang.Object
| Constructor and Description |
|---|
GenericBeanFactoryAccessor(org.springframework.beans.factory.ListableBeanFactory beanFactory)
Constructs a
GenericBeanFactoryAccessor that wraps the supplied ListableBeanFactory. |
| Modifier and Type | Method and Description |
|---|---|
<A extends java.lang.annotation.Annotation> |
findAnnotationOnBean(java.lang.String beanName,
java.lang.Class<A> annotationType)
Find a
Annotation of annotationType on the specified
bean, traversing its interfaces and super classes if no annotation can be
found on the given class itself, as well as checking its raw bean class
if not found on the exposed bean reference (e.g. |
<T> T |
getBean(java.lang.String name) |
<T> T |
getBean(java.lang.String name,
java.lang.Class<T> requiredType) |
org.springframework.beans.factory.ListableBeanFactory |
getBeanFactory()
Return the wrapped
ListableBeanFactory. |
<T> java.util.Map<java.lang.String,T> |
getBeansOfType(java.lang.Class<T> type) |
<T> java.util.Map<java.lang.String,T> |
getBeansOfType(java.lang.Class<T> type,
boolean includeNonSingletons,
boolean allowEagerInit) |
java.util.Map<java.lang.String,java.lang.Object> |
getBeansWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Find all beans whose
Class has the supplied Annotation type. |
public GenericBeanFactoryAccessor(org.springframework.beans.factory.ListableBeanFactory beanFactory)
GenericBeanFactoryAccessor that wraps the supplied ListableBeanFactory.public final org.springframework.beans.factory.ListableBeanFactory getBeanFactory()
ListableBeanFactory.public <T> T getBean(java.lang.String name)
throws org.springframework.beans.BeansException
org.springframework.beans.BeansExceptionBeanFactory.getBean(String)public <T> T getBean(java.lang.String name,
java.lang.Class<T> requiredType)
throws org.springframework.beans.BeansException
org.springframework.beans.BeansExceptionBeanFactory.getBean(String, Class)public <T> java.util.Map<java.lang.String,T> getBeansOfType(java.lang.Class<T> type)
throws org.springframework.beans.BeansException
org.springframework.beans.BeansExceptionListableBeanFactory.getBeansOfType(Class)public <T> java.util.Map<java.lang.String,T> getBeansOfType(java.lang.Class<T> type,
boolean includeNonSingletons,
boolean allowEagerInit)
throws org.springframework.beans.BeansException
org.springframework.beans.BeansExceptionListableBeanFactory.getBeansOfType(Class, boolean, boolean)public java.util.Map<java.lang.String,java.lang.Object> getBeansWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Class has the supplied Annotation type.annotationType - the type of annotation to look forpublic <A extends java.lang.annotation.Annotation> A findAnnotationOnBean(java.lang.String beanName,
java.lang.Class<A> annotationType)
Annotation of annotationType on the specified
bean, traversing its interfaces and super classes if no annotation can be
found on the given class itself, as well as checking its raw bean class
if not found on the exposed bean reference (e.g. in case of a proxy).beanName - the name of the bean to look for annotations onannotationType - the annotation class to look fornullAnnotationUtils.findAnnotation(Class, Class)