public class SpringContextHolder extends Object implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.DisposableBean
构造器和说明 |
---|
SpringContextHolder() |
限定符和类型 | 方法和说明 |
---|---|
static void |
clearHolder()
清除SpringContextHolder中的ApplicationContext为Null.
|
void |
destroy()
实现DisposableBean接口, 在Context关闭时清理静态变量.
|
static org.springframework.context.ApplicationContext |
getApplicationContext()
取得存储在静态变量中的ApplicationContext.
|
static <T> T |
getBean(Class<T> requiredType)
从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
|
static <T> T |
getBean(String name)
从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
实现ApplicationContextAware接口, 注入Context到静态变量中.
|
public static org.springframework.context.ApplicationContext getApplicationContext()
public static <T> T getBean(String name)
public static <T> T getBean(Class<T> requiredType)
public static void clearHolder()
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext
在接口中 org.springframework.context.ApplicationContextAware
Copyright © 2014 EPIC Team. All rights reserved.