public class SpringContextHolder extends Object implements org.springframework.context.ApplicationContextAware
| 构造器和说明 |
|---|
SpringContextHolder() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
autowire(Object bean)
Autowire annotated from spring container for object
|
static boolean |
containsBean(String beanName)
Returns spring container contains specified bean name.
|
static String[] |
getAliases(String beanName)
Returns spring bean name other alias name.
|
static <T> T |
getBean(Class<T> beanType)
Gets spring bean by bean type.
|
static Object |
getBean(String beanName)
Gets spring bean by bean name.
|
static <T> T |
getBean(String beanName,
Class<T> beanType)
Gets spring bean by bean name and type.
|
static <T> T |
getPrototypeBean(Class<T> beanType)
Gets spring bean by bean type, if not defined bean then return null
|
static <T> T |
getPrototypeBean(String beanName,
Class<T> beanType)
Gets spring bean by bean name and type, if not defined bean then return null
|
static Class<?> |
getType(String beanName)
Returns spring bean name type.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext cxt) |
public void setApplicationContext(org.springframework.context.ApplicationContext cxt)
setApplicationContext 在接口中 org.springframework.context.ApplicationContextAwarepublic static Object getBean(String beanName) throws org.springframework.beans.BeansException
beanName - then bean nameorg.springframework.beans.BeansExceptionpublic static <T> T getBean(Class<T> beanType)
beanType - the bean typepublic static <T> T getBean(String beanName, Class<T> beanType)
beanName - the bean namebeanType - the bean typepublic static <T> T getPrototypeBean(String beanName, Class<T> beanType) throws IllegalStateException
beanName - the bean namebeanType - the bean typeIllegalStateException - if not prototype beanpublic static <T> T getPrototypeBean(Class<T> beanType) throws IllegalStateException
beanType - the bean typeIllegalStateException - if not prototype beanpublic static boolean containsBean(String beanName)
beanName - the bean nametrue if contains beanpublic static Class<?> getType(String beanName)
beanName - then bean namepublic static String[] getAliases(String beanName)
beanName - then bean namepublic static void autowire(Object bean)
bean - the spring beanCopyright © 2023. All rights reserved.