Package net.mingsoft.basic.util
Class SpringUtil
java.lang.Object
net.mingsoft.basic.util.SpringUtil
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
@Component
public class SpringUtil
extends Object
implements org.springframework.context.ApplicationContextAware
- Author:
- 铭软开发团队
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.context.ApplicationContextstatic ObjectDeprecated.static <T> T通过spring的webapplicationcontext上下文对象读取bean对象static Object通过spring的webapplicationcontext上下文对象读取bean对象static StringgetProperty(String key) 读取配置文件中的配置static jakarta.servlet.http.HttpServletRequest获取当前请求对象voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) static voidsetRequest(jakarta.servlet.http.HttpServletRequest request) 设置当前请求对象
-
Constructor Details
-
SpringUtil
public SpringUtil()
-
-
Method Details
-
getRequest
public static jakarta.servlet.http.HttpServletRequest getRequest()获取当前请求对象- Returns:
-
setRequest
public static void setRequest(jakarta.servlet.http.HttpServletRequest request) 设置当前请求对象 -
getBean
Deprecated.通过spring的webapplicationcontext上下文对象读取bean对象- Parameters:
sc- 上下文servletConext对象beanName- 要读取的bean的名称- Returns:
- 返回获取到的对象。获取不到返回null
-
getBean
通过spring的webapplicationcontext上下文对象读取bean对象- Parameters:
beanName- 要读取的bean的名称- Returns:
- 返回获取到的对象。获取不到返回null
-
getBean
通过spring的webapplicationcontext上下文对象读取bean对象- Parameters:
cls- 要读取的类名称- Returns:
- 返回获取到的对象。获取不到返回null
-
getProperty
读取配置文件中的配置- Parameters:
key- 配置文件中对应的key- Returns:
- 对应key配置的值
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
getApplicationContext
public static org.springframework.context.ApplicationContext getApplicationContext()
-