@Component public class SpringContextUtil extends Object implements org.springframework.context.ApplicationContextAware
| 构造器和说明 |
|---|
SpringContextUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static org.springframework.context.ApplicationContext |
getApplicationContext()
获取上下文
|
static String |
getAttributeValue(String key)
获取application 里的属性值
|
static <T> T |
getBean(Class<T> requiredType)
通过类型获取上下文中的bean
|
static Object |
getBean(String name)
通过名字获取上下文中的bean
|
static String |
getCurrentPath() |
static void |
printInfo() |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
设置上下文
|
public static org.springframework.context.ApplicationContext getApplicationContext()
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext 在接口中 org.springframework.context.ApplicationContextAwareapplicationContext - applicationContextpublic static String getCurrentPath()
public static <T> T getBean(Class<T> requiredType)
requiredType - classNamepublic static String getAttributeValue(String key)
key - keypublic static void printInfo()
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.