public class SpringContextHolder extends Object implements org.springframework.context.ApplicationContextAware
| 构造器和说明 |
|---|
SpringContextHolder() |
| 限定符和类型 | 方法和说明 |
|---|---|
static org.springframework.context.ApplicationContext |
getApplicationContext() |
static <T> T |
getBean(Class<T> requiredType)
根据bean类型获取bean实例
|
static <T> T |
getBean(String beanName)
根据bean名称获取bean实例
|
void |
registerBean(Object obj)
注册bean到spring ioc容器中
|
void |
registerBean(String beanName,
Object obj)
注册bean到spring ioc容器中
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
public void setApplicationContext(@NonNull
org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext 在接口中 org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic static org.springframework.context.ApplicationContext getApplicationContext()
public static <T> T getBean(String beanName)
beanName - bean名称public static <T> T getBean(Class<T> requiredType)
requiredType - bean类型public void registerBean(Object obj)
obj - bean对象Copyright © 2019. All rights reserved.