@Component public class SpringUtil extends Object implements org.springframework.context.ApplicationContextAware
| Constructor and Description |
|---|
SpringUtil() |
| Modifier and Type | Method and Description |
|---|---|
static org.springframework.context.ApplicationContext |
getApplicationContext() |
static <T> T |
getBean(Class<T> cls)
通过spring的webapplicationcontext上下文对象读取bean对象
|
static Object |
getBean(javax.servlet.ServletContext sc,
String beanName)
Deprecated.
|
static Object |
getBean(String beanName)
通过spring的webapplicationcontext上下文对象读取bean对象
|
static javax.servlet.http.HttpServletRequest |
getRequest()
获取当前请求对象
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
static void |
setRequest(javax.servlet.http.HttpServletRequest request)
设置当前请求对象
|
public static javax.servlet.http.HttpServletRequest getRequest()
public static void setRequest(javax.servlet.http.HttpServletRequest request)
@Deprecated public static Object getBean(javax.servlet.ServletContext sc, String beanName)
sc - 上下文servletConext对象beanName - 要读取的bean的名称public static Object getBean(String beanName)
beanName - 要读取的bean的名称public static <T> T getBean(Class<T> cls)
cls - 要读取的类名称public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic static org.springframework.context.ApplicationContext getApplicationContext()
Copyright © 2020. All rights reserved.