类 StandardApplicationContext
java.lang.Object
cn.taketoday.core.io.DefaultResourceLoader
cn.taketoday.context.support.AbstractApplicationContext
cn.taketoday.context.support.GenericApplicationContext
cn.taketoday.context.support.StandardApplicationContext
- 所有已实现的接口:
BeanFactory,HierarchicalBeanFactory,BeanDefinitionRegistry,DependencyInjectorProvider,AnnotationConfigRegistry,ApplicationContext,ApplicationEventPublisher,ConfigurableApplicationContext,Lifecycle,MessageSource,cn.taketoday.core.AliasRegistry,cn.taketoday.core.env.EnvironmentCapable,cn.taketoday.core.io.PatternResourceLoader,cn.taketoday.core.io.ResourceLoader,Closeable,AutoCloseable
public class StandardApplicationContext
extends GenericApplicationContext
implements ConfigurableApplicationContext, BeanDefinitionRegistry, AnnotationConfigRegistry
Standard
ApplicationContext
like Spring's AnnotationConfigApplicationContext- 作者:
- TODAY 2018-09-06 13:47
-
嵌套类概要
从类继承的嵌套类/接口 cn.taketoday.core.io.DefaultResourceLoader
cn.taketoday.core.io.DefaultResourceLoader.ClassPathContextResource从接口继承的嵌套类/接口 cn.taketoday.context.ApplicationContext
ApplicationContext.State -
字段概要
从类继承的字段 cn.taketoday.context.support.GenericApplicationContext
beanFactory从类继承的字段 cn.taketoday.context.support.AbstractApplicationContext
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, log, MESSAGE_SOURCE_BEAN_NAME从接口继承的字段 cn.taketoday.context.ApplicationContext
APPLICATION_NAME从接口继承的字段 cn.taketoday.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX从接口继承的字段 cn.taketoday.context.ConfigurableApplicationContext
CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SHUTDOWN_HOOK_THREAD_NAME从接口继承的字段 cn.taketoday.core.io.PatternResourceLoader
CLASSPATH_ALL_URL_PREFIX从接口继承的字段 cn.taketoday.core.io.ResourceLoader
CLASSPATH_URL_PREFIX -
构造器概要
构造器构造器说明Default ConstructorStandardApplicationContext(StandardBeanFactory beanFactory) Construct withStandardBeanFactoryStandardApplicationContext(StandardBeanFactory beanFactory, ApplicationContext parent) Create a new StandardApplicationContext with the given StandardBeanFactory.Create a new StandardApplicationContext with the given parent.StandardApplicationContext(Class<?>... components) Start with given class setStandardApplicationContext(String... basePackages) Start context with given properties location and base scan packages -
方法概要
修饰符和类型方法说明voidRegister one or more component classes to be processed.<T> voidregisterBean(String beanName, Class<T> beanClass, Supplier<T> supplier, BeanDefinitionCustomizer... customizers) Register a bean from the given bean class, using the given supplier for obtaining a new instance (typically declared as a lambda expression or method reference), optionally customizing its bean definition metadata (again typically declared as a lambda expression).voidPerform a scan within the specified base packages.voidsetBeanNameGenerator(BeanNameGenerator beanNameGenerator) Provide a customBeanNameGeneratorfor use withAnnotatedBeanDefinitionReaderand/orBootstrapContext, if any.voidsetEnvironment(cn.taketoday.core.env.ConfigurableEnvironment environment) Propagate the given customEnvironmentto the underlyingAnnotatedBeanDefinitionReaderandClassPathBeanDefinitionScanner.voidsetScopeMetadataResolver(ScopeMetadataResolver scopeMetadataResolver) Set theScopeMetadataResolverto use for registered component classes.从类继承的方法 cn.taketoday.context.support.GenericApplicationContext
cancelRefresh, closeBeanFactory, containsBeanDefinition, containsBeanDefinition, containsBeanDefinition, createBootstrapContext, getAliasList, getAutowireCapableBeanFactory, getBeanDefinition, getBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactory, getClassLoader, getResource, getResources, isAlias, isAllowBeanDefinitionOverriding, isBeanNameInUse, refreshBeanFactory, registerAlias, registerBean, registerBean, registerBean, registerBean, registerBean, registerBeanDefinition, registerPrototype, registerPrototype, registerSingleton, registerSingleton, registerSingleton, registerSingleton, removeAlias, removeBeanDefinition, scan, setAllowBeanDefinitionOverriding, setAllowCircularReferences, setClassLoader, setParent, setResourceLoader从类继承的方法 cn.taketoday.context.support.AbstractApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, addFactoryPostProcessors, applyState, assertBeanFactoryActive, close, containsBean, containsLocalBean, createEnvironment, destroyBeans, doClose, findAnnotationOnBean, findAnnotationOnBean, findSynthesizedAnnotation, finishBeanFactoryInitialization, finishRefresh, formatStartupDate, getAliases, getAnnotatedBeans, getApplicationEventMulticaster, getApplicationListeners, getApplicationName, getBean, getBean, getBean, getBean, getBean, getBeanDefinitions, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeans, getBeansOfType, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getBeansWithAnnotation, getBootstrapContext, getDisplayName, getEnvironment, getExpressionEvaluator, getFactoryPostProcessors, getId, getInjector, getInternalParentBeanFactory, getInternalParentMessageSource, getLifecycleProcessor, getMessage, getMessage, getMessage, getObjectSupplier, getObjectSupplier, getObjectSupplier, getObjectSupplier, getParent, getParentBeanFactory, getPatternResourceLoader, getStartupDate, getState, getType, getType, hasStarted, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, initPropertySources, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, isTypeMatch, obtainBootstrapContext, obtainFreshBeanFactory, onClose, onRefresh, postProcessBeanFactory, prepareBeanFactory, prepareRefresh, publishEvent, publishEvent, refresh, registerApplicationListeners, registerBeanPostProcessors, registerFrameworkComponents, registerShutdownHook, removeApplicationListener, resetCommonCaches, setBootstrapContext, setDisplayName, setId, setLifecycleProcessor, start, stop, toString, unwrapFactory从类继承的方法 cn.taketoday.core.io.DefaultResourceLoader
addProtocolResolver, clearResourceCaches, getProtocolResolvers, getResourceByPath, getResourceCache从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait从接口继承的方法 cn.taketoday.core.AliasRegistry
getAliases, getAliasList, isAlias, registerAlias, removeAlias从接口继承的方法 cn.taketoday.context.ApplicationContext
getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getExpressionEvaluator, getId, getParent, getStartupDate, getState, hasStarted, unwrapFactory从接口继承的方法 cn.taketoday.context.ApplicationEventPublisher
publishEvent从接口继承的方法 cn.taketoday.beans.factory.support.BeanDefinitionRegistry
containsBeanDefinition, containsBeanDefinition, containsBeanDefinition, containsBeanDefinition, getBeanDefinition, getBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitions, isAllowBeanDefinitionOverriding, isBeanNameInUse, registerBeanDefinition, removeBeanDefinition从接口继承的方法 cn.taketoday.beans.factory.BeanFactory
containsBean, containsBeanDefinition, findAnnotationOnBean, findAnnotationOnBean, findSynthesizedAnnotation, getAliases, getAnnotatedBeans, getBean, getBean, getBean, getBean, getBean, getBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitions, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeans, getBeansOfType, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getBeansWithAnnotation, getObjectSupplier, getObjectSupplier, getObjectSupplier, getObjectSupplier, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatch, unwrap从接口继承的方法 cn.taketoday.context.ConfigurableApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, addProtocolResolver, close, getBeanFactory, getEnvironment, isActive, refresh, registerShutdownHook, removeApplicationListener, setClassLoader, setId, setParent从接口继承的方法 cn.taketoday.beans.factory.support.DependencyInjectorProvider
getInjector从接口继承的方法 cn.taketoday.beans.factory.HierarchicalBeanFactory
containsLocalBean, getParentBeanFactory从接口继承的方法 cn.taketoday.context.MessageSource
getMessage, getMessage, getMessage从接口继承的方法 cn.taketoday.core.io.PatternResourceLoader
getResources, getResourcesArray, scan从接口继承的方法 cn.taketoday.core.io.ResourceLoader
getClassLoader, getResource
-
构造器详细资料
-
StandardApplicationContext
public StandardApplicationContext()Default Constructor -
StandardApplicationContext
Construct withStandardBeanFactory- 参数:
beanFactory-StandardBeanFactoryinstance
-
StandardApplicationContext
Create a new StandardApplicationContext with the given parent.- 参数:
parent- the parent application context- 另请参阅:
-
StandardApplicationContext
Create a new StandardApplicationContext with the given StandardBeanFactory.- 参数:
beanFactory- the StandardBeanFactory instance to use for this contextparent- the parent application context- 另请参阅:
-
StandardApplicationContext
Start with given class set- 参数:
components- one or more component classes, e.g.@Configurationclasses- 另请参阅:
-
StandardApplicationContext
Start context with given properties location and base scan packages- 参数:
basePackages- scan classes from packages- 另请参阅:
-
-
方法详细资料
-
register
Register one or more component classes to be processed.Note that
AbstractApplicationContext.refresh()must be called in order for the context to fully process the new classes.- 指定者:
register在接口中AnnotationConfigRegistry- 参数:
components- one or more component classes — for example,@Configurationclasses- 另请参阅:
-
scan
Perform a scan within the specified base packages.Note that
AbstractApplicationContext.refresh()must be called in order for the context to fully process the new classes.- 指定者:
scan在接口中AnnotationConfigRegistry- 参数:
basePackages- the packages to scan for component classes- 另请参阅:
-
setBeanNameGenerator
Provide a customBeanNameGeneratorfor use withAnnotatedBeanDefinitionReaderand/orBootstrapContext, if any.Default is
AnnotationBeanNameGenerator.Any call to this method must occur prior to calls to
register(Class...)and/orscan(String...). -
setScopeMetadataResolver
Set theScopeMetadataResolverto use for registered component classes.The default is an
AnnotationScopeMetadataResolver.Any call to this method must occur prior to calls to
register(Class...)and/orscan(String...). -
setEnvironment
public void setEnvironment(cn.taketoday.core.env.ConfigurableEnvironment environment) Propagate the given customEnvironmentto the underlyingAnnotatedBeanDefinitionReaderandClassPathBeanDefinitionScanner.- 指定者:
setEnvironment在接口中ConfigurableApplicationContext- 覆盖:
setEnvironment在类中AbstractApplicationContext- 参数:
environment- the new environment
-
registerBean
public <T> void registerBean(@Nullable String beanName, Class<T> beanClass, @Nullable Supplier<T> supplier, BeanDefinitionCustomizer... customizers) 从类复制的说明:GenericApplicationContextRegister a bean from the given bean class, using the given supplier for obtaining a new instance (typically declared as a lambda expression or method reference), optionally customizing its bean definition metadata (again typically declared as a lambda expression).This method can be overridden to adapt the registration mechanism for all
registerBeanmethods (since they all delegate to this one).- 覆盖:
registerBean在类中GenericApplicationContext- 参数:
beanName- the name of the bean (may benull)beanClass- the class of the beansupplier- a callback for creating an instance of the bean (in case ofnull, resolving a public constructor to be autowired instead)customizers- one or more callbacks for customizing the factory'sBeanDefinition, e.g. setting a lazy-init or primary flag
-