public 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 |
getActiveProfile()
获取当前的环境配置,当有多个环境配置时,只获取第一个
|
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 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
T - 泛型name - 对象名org.springframework.beans.BeansExceptionpublic static <T> T getBean(Class<T> clz) throws org.springframework.beans.BeansException
T - 泛型clz - 对象的classorg.springframework.beans.BeansExceptionpublic static boolean containsBean(String name)
name - bean名public static boolean isSingleton(String name) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
name - bean名org.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic static Class<?> getType(String name) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
name - bean名org.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic static String[] getAliases(String name) throws org.springframework.beans.factory.NoSuchBeanDefinitionException
name - bean名org.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic static <T> T getAopProxy(T invoker)
T - 泛型invoker - objectpublic static String[] getActiveProfiles()
public static String getActiveProfile()
Copyright © 2021. All rights reserved.