@Component public class SpringContextUtils extends Object implements org.springframework.context.ApplicationContextAware
| Modifier and Type | Field and Description |
|---|---|
static org.springframework.context.ApplicationContext |
applicationContext |
| Constructor and Description |
|---|
SpringContextUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsBean(String name) |
static <T> T |
getBean(Class<T> requiredType)
从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
|
static Object |
getBean(String name) |
static <T> T |
getBean(String name,
Class<T> requiredType) |
static Class<? extends Object> |
getType(String name) |
static boolean |
isSingleton(String name) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
public static org.springframework.context.ApplicationContext applicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic static boolean containsBean(String name)
public static boolean isSingleton(String name)
public static <T> T getBean(Class<T> requiredType)
Copyright © 2021. All rights reserved.