@Component public final class SpringUtil extends Object implements org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.context.ApplicationContextAware
| 构造器和说明 |
|---|
SpringUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
containsBean(String name)
如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true
|
static String[] |
getActiveProfiles()
获取当前的环境配置,无配置返回null
|
static String[] |
getAliases(String name)
如果给定的bean名字在bean定义中有别名,则返回这些别名
|
static <T> T |
getAopProxy(T invoker)
获取aop代理对象
|
static <T> T |
getBean(Class<T> clz)
获取类型为requiredType的对象
|
static <T> T |
getBean(String name)
获取对象
|
static String |
getRequiredProperty(String key)
获取配置文件中的值
|
static Class<?> |
getType(String name) |
static boolean |
isSingleton(String name)
判断以给定名字注册的bean定义是一个singleton还是一个prototype。
|
void |
postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
throws org.springframework.beans.BeansException
postProcessBeanFactory 在接口中 org.springframework.beans.factory.config.BeanFactoryPostProcessororg.springframework.beans.BeansExceptionpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext 在接口中 org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic static <T> T getBean(String name) throws org.springframework.beans.BeansException
name - org.springframework.beans.BeansExceptionpublic static <T> T getBean(Class<T> clz) throws org.springframework.beans.BeansException
clz - org.springframework.beans.BeansExceptionpublic static boolean containsBean(String name)
name - public static boolean isSingleton(String name) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
name - org.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic static Class<?> getType(String name) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
name - org.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic static String[] getAliases(String name) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
name - org.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic static <T> T getAopProxy(T invoker)
invoker - public static String[] getActiveProfiles()
Copyright © 2024. All rights reserved.