@Configuration
@Component
public class ZSpringContextUtil
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware
构造器和说明 |
---|
ZSpringContextUtil() |
限定符和类型 | 方法和说明 |
---|---|
static org.springframework.context.ApplicationContext |
getApplicationContext()
获取上下文对象
|
static <T> T |
getBean(java.lang.Class<T> var1)
根据class获取bean对象
|
static java.lang.Object |
getBean(java.lang.String name)
根据名称获取bean对象
|
static <T> T |
getBean(java.lang.String name,
java.lang.Class<T> var1)
根据名称和class获取bean对象
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
在接口中 org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public static java.lang.Object getBean(java.lang.String name) throws org.springframework.beans.BeansException
name
- 输入的名称org.springframework.beans.BeansException
- 抛出错误public static <T> T getBean(java.lang.Class<T> var1)
T
- bean的类型var1
- bean的classpublic static <T> T getBean(java.lang.String name, java.lang.Class<T> var1)
T
- bean的类型name
- bean的名称var1
- bean的classpublic static org.springframework.context.ApplicationContext getApplicationContext()