类 ApplicationUtils
- java.lang.Object
-
- com.alibaba.nacos.sys.utils.ApplicationUtils
-
- 所有已实现的接口:
org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>
public class ApplicationUtils extends java.lang.Object implements org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>Nacos global tool class.- 作者:
- liaochuntao
-
-
字段概要
字段 修饰符和类型 字段 说明 private static org.springframework.context.ApplicationContextapplicationContextprivate static booleanstarted
-
构造器概要
构造器 构造器 说明 ApplicationUtils()
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static booleancontainsBean(java.lang.String name)static booleancontainsBeanDefinition(java.lang.String beanName)static booleancontainsLocalBean(java.lang.String name)static <A extends java.lang.annotation.Annotation>
AfindAnnotationOnBean(java.lang.String beanName, java.lang.Class<A> annotationType)static java.lang.String[]getAliases(java.lang.String name)static org.springframework.context.ApplicationContextgetApplicationContext()static java.lang.StringgetApplicationName()static org.springframework.beans.factory.config.AutowireCapableBeanFactorygetAutowireCapableBeanFactory()static <T> TgetBean(java.lang.Class<T> requiredType)static <T> TgetBean(java.lang.Class<T> requiredType, java.lang.Object... args)static java.lang.ObjectgetBean(java.lang.String name)static <T> TgetBean(java.lang.String name, java.lang.Class<T> requiredType)static java.lang.ObjectgetBean(java.lang.String name, java.lang.Object... args)static intgetBeanDefinitionCount()static java.lang.String[]getBeanDefinitionNames()static <T> voidgetBeanIfExist(java.lang.Class<T> requiredType, java.util.function.Consumer<T> consumer)static java.lang.String[]getBeanNamesForAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)static java.lang.String[]getBeanNamesForType(java.lang.Class<?> type)static java.lang.String[]getBeanNamesForType(java.lang.Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)static java.lang.String[]getBeanNamesForType(org.springframework.core.ResolvableType type)static <T> org.springframework.beans.factory.ObjectProvider<T>getBeanProvider(java.lang.Class<T> requiredType)static <T> org.springframework.beans.factory.ObjectProvider<T>getBeanProvider(org.springframework.core.ResolvableType requiredType)static <T> java.util.Map<java.lang.String,T>getBeansOfType(java.lang.Class<T> type)static <T> java.util.Map<java.lang.String,T>getBeansOfType(java.lang.Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)static java.util.Map<java.lang.String,java.lang.Object>getBeansWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)static java.lang.ClassLoadergetClassLoader()static java.lang.StringgetDisplayName()static java.lang.StringgetId()static java.lang.StringgetMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage, java.util.Locale locale)static java.lang.StringgetMessage(java.lang.String code, java.lang.Object[] args, java.util.Locale locale)static java.lang.StringgetMessage(org.springframework.context.MessageSourceResolvable resolvable, java.util.Locale locale)static org.springframework.context.ApplicationContextgetParent()static org.springframework.beans.factory.BeanFactorygetParentBeanFactory()static org.springframework.core.io.ResourcegetResource(java.lang.String location)static org.springframework.core.io.Resource[]getResources(java.lang.String locationPattern)static longgetStartupDate()static java.lang.Class<?>getType(java.lang.String name)voidinitialize(org.springframework.context.ConfigurableApplicationContext context)static voidinjectContext(org.springframework.context.ConfigurableApplicationContext context)static booleanisPrototype(java.lang.String name)static booleanisSingleton(java.lang.String name)static booleanisStarted()static booleanisTypeMatch(java.lang.String name, java.lang.Class<?> typeToMatch)static booleanisTypeMatch(java.lang.String name, org.springframework.core.ResolvableType typeToMatch)static voidpublishEvent(java.lang.Object event)static voidsetStarted(boolean started)
-
-
-
方法详细资料
-
getId
public static java.lang.String getId()
-
getApplicationName
public static java.lang.String getApplicationName()
-
getDisplayName
public static java.lang.String getDisplayName()
-
getStartupDate
public static long getStartupDate()
-
getParent
public static org.springframework.context.ApplicationContext getParent()
-
getAutowireCapableBeanFactory
public static org.springframework.beans.factory.config.AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws java.lang.IllegalStateException- 抛出:
java.lang.IllegalStateException
-
isStarted
public static boolean isStarted()
-
setStarted
public static void setStarted(boolean started)
-
getParentBeanFactory
public static org.springframework.beans.factory.BeanFactory getParentBeanFactory()
-
containsLocalBean
public static boolean containsLocalBean(java.lang.String name)
-
containsBeanDefinition
public static boolean containsBeanDefinition(java.lang.String beanName)
-
getBeanDefinitionCount
public static int getBeanDefinitionCount()
-
getBeanDefinitionNames
public static java.lang.String[] getBeanDefinitionNames()
-
getBeanNamesForType
public static java.lang.String[] getBeanNamesForType(org.springframework.core.ResolvableType type)
-
getBeanNamesForType
public static java.lang.String[] getBeanNamesForType(java.lang.Class<?> type)
-
getBeanNamesForType
public static java.lang.String[] getBeanNamesForType(java.lang.Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)
-
getBeansOfType
public static <T> java.util.Map<java.lang.String,T> getBeansOfType(java.lang.Class<T> type) throws org.springframework.beans.BeansException- 抛出:
org.springframework.beans.BeansException
-
getBeansOfType
public static <T> java.util.Map<java.lang.String,T> getBeansOfType(java.lang.Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) throws org.springframework.beans.BeansException- 抛出:
org.springframework.beans.BeansException
-
getBeanNamesForAnnotation
public static java.lang.String[] getBeanNamesForAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
-
getBeansWithAnnotation
public static java.util.Map<java.lang.String,java.lang.Object> getBeansWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType) throws org.springframework.beans.BeansException- 抛出:
org.springframework.beans.BeansException
-
findAnnotationOnBean
public static <A extends java.lang.annotation.Annotation> A findAnnotationOnBean(java.lang.String beanName, java.lang.Class<A> annotationType) throws org.springframework.beans.factory.NoSuchBeanDefinitionException- 抛出:
org.springframework.beans.factory.NoSuchBeanDefinitionException
-
getBean
public static java.lang.Object getBean(java.lang.String name) throws org.springframework.beans.BeansException- 抛出:
org.springframework.beans.BeansException
-
getBean
public static <T> T getBean(java.lang.String name, java.lang.Class<T> requiredType) throws org.springframework.beans.BeansException- 抛出:
org.springframework.beans.BeansException
-
getBean
public static java.lang.Object getBean(java.lang.String name, java.lang.Object... args) throws org.springframework.beans.BeansException- 抛出:
org.springframework.beans.BeansException
-
getBean
public static <T> T getBean(java.lang.Class<T> requiredType) throws org.springframework.beans.BeansException- 抛出:
org.springframework.beans.BeansException
-
getBeanIfExist
public static <T> void getBeanIfExist(java.lang.Class<T> requiredType, java.util.function.Consumer<T> consumer) throws org.springframework.beans.BeansException- 抛出:
org.springframework.beans.BeansException
-
getBean
public static <T> T getBean(java.lang.Class<T> requiredType, java.lang.Object... args) throws org.springframework.beans.BeansException- 抛出:
org.springframework.beans.BeansException
-
getBeanProvider
public static <T> org.springframework.beans.factory.ObjectProvider<T> getBeanProvider(java.lang.Class<T> requiredType)
-
getBeanProvider
public static <T> org.springframework.beans.factory.ObjectProvider<T> getBeanProvider(org.springframework.core.ResolvableType requiredType)
-
containsBean
public static boolean containsBean(java.lang.String name)
-
isSingleton
public static boolean isSingleton(java.lang.String name) throws org.springframework.beans.factory.NoSuchBeanDefinitionException- 抛出:
org.springframework.beans.factory.NoSuchBeanDefinitionException
-
isPrototype
public static boolean isPrototype(java.lang.String name) throws org.springframework.beans.factory.NoSuchBeanDefinitionException- 抛出:
org.springframework.beans.factory.NoSuchBeanDefinitionException
-
isTypeMatch
public static boolean isTypeMatch(java.lang.String name, org.springframework.core.ResolvableType typeToMatch) throws org.springframework.beans.factory.NoSuchBeanDefinitionException- 抛出:
org.springframework.beans.factory.NoSuchBeanDefinitionException
-
isTypeMatch
public static boolean isTypeMatch(java.lang.String name, java.lang.Class<?> typeToMatch) throws org.springframework.beans.factory.NoSuchBeanDefinitionException- 抛出:
org.springframework.beans.factory.NoSuchBeanDefinitionException
-
getType
public static java.lang.Class<?> getType(java.lang.String name) throws org.springframework.beans.factory.NoSuchBeanDefinitionException- 抛出:
org.springframework.beans.factory.NoSuchBeanDefinitionException
-
getAliases
public static java.lang.String[] getAliases(java.lang.String name)
-
publishEvent
public static void publishEvent(java.lang.Object event)
-
getMessage
public static java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage, java.util.Locale locale)
-
getMessage
public static java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.util.Locale locale) throws org.springframework.context.NoSuchMessageException- 抛出:
org.springframework.context.NoSuchMessageException
-
getMessage
public static java.lang.String getMessage(org.springframework.context.MessageSourceResolvable resolvable, java.util.Locale locale) throws org.springframework.context.NoSuchMessageException- 抛出:
org.springframework.context.NoSuchMessageException
-
getResources
public static org.springframework.core.io.Resource[] getResources(java.lang.String locationPattern) throws java.io.IOException- 抛出:
java.io.IOException
-
getResource
public static org.springframework.core.io.Resource getResource(java.lang.String location)
-
getClassLoader
public static java.lang.ClassLoader getClassLoader()
-
getApplicationContext
public static org.springframework.context.ApplicationContext getApplicationContext()
-
injectContext
public static void injectContext(org.springframework.context.ConfigurableApplicationContext context)
-
initialize
public void initialize(org.springframework.context.ConfigurableApplicationContext context)
- 指定者:
initialize在接口中org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>
-
-