| 构造器和说明 |
|---|
BeanUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T |
getBeanIfAvailable(org.springframework.beans.factory.BeanFactory beanFactory,
String beanName,
Class<T> beanType)
Get the bean via the specified bean name and type if available
|
static String[] |
getBeanNames(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
Class<?> beanClass)
Get Bean Names from
ListableBeanFactory by type. |
static String[] |
getBeanNames(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
Class<?> beanClass,
boolean includingAncestors)
Get Bean Names from
ListableBeanFactory by type. |
static String[] |
getBeanNames(org.springframework.beans.factory.ListableBeanFactory beanFactory,
Class<?> beanClass)
Get Bean Names from
ListableBeanFactory by type. |
static String[] |
getBeanNames(org.springframework.beans.factory.ListableBeanFactory beanFactory,
Class<?> beanClass,
boolean includingAncestors)
Get Bean Names from
ListableBeanFactory by type. |
static <T> T |
getOptionalBean(org.springframework.beans.factory.ListableBeanFactory beanFactory,
Class<T> beanClass)
Get Optional Bean by
Class. |
static <T> T |
getOptionalBean(org.springframework.beans.factory.ListableBeanFactory beanFactory,
Class<T> beanClass,
boolean includingAncestors)
Get Optional Bean by
Class including ancestors(BeanFactory). |
static <T> List<T> |
getSortedBeans(org.springframework.beans.factory.ListableBeanFactory beanFactory,
Class<T> type)
Get all sorted Beans of
ListableBeanFactory in specified bean type. |
static boolean |
isBeanPresent(org.springframework.beans.factory.BeanFactory beanFactory,
String beanName,
Class<?> beanClass)
Is Bean Present or not by the specified name and class
|
static boolean |
isBeanPresent(org.springframework.beans.factory.ListableBeanFactory beanFactory,
Class<?> beanClass)
Is Bean Present or not?
|
static boolean |
isBeanPresent(org.springframework.beans.factory.ListableBeanFactory beanFactory,
Class<?> beanClass,
boolean includingAncestors)
Is Bean Present or not?
|
static boolean |
isBeanPresent(org.springframework.beans.factory.ListableBeanFactory beanFactory,
String beanClassName)
Is Bean Present or not?
|
static boolean |
isBeanPresent(org.springframework.beans.factory.ListableBeanFactory beanFactory,
String beanClassName,
boolean includingAncestors)
Is Bean Present or not?
|
static Class<?> |
resolveBeanType(String beanClassName,
ClassLoader classLoader)
Resolve Bean Type
|
static <T> Map<String,T> |
sort(Map<String,T> beansMap)
Sort Beans
Map via AnnotationAwareOrderComparator.sort(List) rule |
public static boolean isBeanPresent(org.springframework.beans.factory.ListableBeanFactory beanFactory,
Class<?> beanClass)
beanFactory - ListableBeanFactorybeanClass - The Class of Beantrue , or falsepublic static boolean isBeanPresent(org.springframework.beans.factory.ListableBeanFactory beanFactory,
Class<?> beanClass,
boolean includingAncestors)
beanFactory - ListableBeanFactorybeanClass - The Class of BeanincludingAncestors - including ancestors or nottrue , or falsepublic static boolean isBeanPresent(org.springframework.beans.factory.ListableBeanFactory beanFactory,
String beanClassName,
boolean includingAncestors)
beanFactory - ListableBeanFactorybeanClassName - The name of Class of BeanincludingAncestors - including ancestors or nottrue , or falsepublic static boolean isBeanPresent(org.springframework.beans.factory.ListableBeanFactory beanFactory,
String beanClassName)
beanFactory - ListableBeanFactorybeanClassName - The name of Class of Beantrue , or falsepublic static boolean isBeanPresent(org.springframework.beans.factory.BeanFactory beanFactory,
String beanName,
Class<?> beanClass)
throws NullPointerException
beanFactory - BeanFactorybeanName - The bean namebeanClass - The bean classtrue , or falseNullPointerExceptionpublic static String[] getBeanNames(org.springframework.beans.factory.ListableBeanFactory beanFactory, Class<?> beanClass)
ListableBeanFactory by type.beanFactory - ListableBeanFactorybeanClass - The Class of Beanpublic static String[] getBeanNames(org.springframework.beans.factory.ListableBeanFactory beanFactory, Class<?> beanClass, boolean includingAncestors)
ListableBeanFactory by type.beanFactory - ListableBeanFactorybeanClass - The Class of BeanincludingAncestors - including ancestors or notpublic static String[] getBeanNames(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, Class<?> beanClass)
ListableBeanFactory by type.beanFactory - ConfigurableListableBeanFactorybeanClass - The Class of Beanpublic static String[] getBeanNames(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, Class<?> beanClass, boolean includingAncestors)
ListableBeanFactory by type.beanFactory - ConfigurableListableBeanFactorybeanClass - The Class of BeanincludingAncestors - including ancestors or notpublic static Class<?> resolveBeanType(String beanClassName, ClassLoader classLoader)
beanClassName - the class name of BeanclassLoader - ClassLoadernull.public static <T> T getOptionalBean(org.springframework.beans.factory.ListableBeanFactory beanFactory,
Class<T> beanClass,
boolean includingAncestors)
throws org.springframework.beans.BeansException
Class including ancestors(BeanFactory).T - The Class of BeanbeanFactory - ListableBeanFactorybeanClass - The Class of BeanincludingAncestors - including ancestors or notnull.org.springframework.beans.factory.NoUniqueBeanDefinitionException - if more than one bean of the given type was foundorg.springframework.beans.BeansExceptionBeanFactoryUtils.beanOfTypeIncludingAncestors(ListableBeanFactory, Class)public static <T> T getOptionalBean(org.springframework.beans.factory.ListableBeanFactory beanFactory,
Class<T> beanClass)
throws org.springframework.beans.BeansException
Class.T - The Class of BeanbeanFactory - ListableBeanFactorybeanClass - The Class of Beannull.org.springframework.beans.factory.NoUniqueBeanDefinitionException - if more than one bean of the given type was foundorg.springframework.beans.BeansExceptionpublic static <T> T getBeanIfAvailable(org.springframework.beans.factory.BeanFactory beanFactory,
String beanName,
Class<T> beanType)
throws org.springframework.beans.BeansException
T - the bean typebeanFactory - BeanFactorybeanName - the bean namebeanType - the class of beannullorg.springframework.beans.BeansException - in case of creation errorspublic static <T> List<T> getSortedBeans(org.springframework.beans.factory.ListableBeanFactory beanFactory, Class<T> type)
ListableBeanFactory in specified bean type.T - bean typebeanFactory - ListableBeanFactorytype - bean typeCopyright © 2020. All rights reserved.