类 GenericXmlApplicationContext
java.lang.Object
cn.taketoday.core.io.DefaultResourceLoader
cn.taketoday.context.support.AbstractApplicationContext
cn.taketoday.context.support.GenericApplicationContext
cn.taketoday.context.support.GenericXmlApplicationContext
- 所有已实现的接口:
BeanFactory,HierarchicalBeanFactory,BeanDefinitionRegistry,DependencyInjectorProvider,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
Convenient application context with built-in XML support.
This is a flexible alternative to
ClassPathXmlApplicationContext
and FileSystemXmlApplicationContext, to be configured via setters,
with an eventual AbstractApplicationContext.refresh() call activating the context.
In case of multiple configuration files, bean definitions in later files will override those defined in earlier files. This can be leveraged to intentionally override certain bean definitions via an extra configuration file appended to the list.
- 从以下版本开始:
- 4.0 2022/3/6 22:26
- 作者:
- Juergen Hoeller, Chris Beams, Harry Yang
- 另请参阅:
-
嵌套类概要
从类继承的嵌套类/接口 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 -
构造器概要
构造器构造器说明GenericXmlApplicationContext(cn.taketoday.core.io.Resource... resources) Create a new GenericXmlApplicationContext, loading bean definitions from the given resources and automatically refreshing the context.GenericXmlApplicationContext(Class<?> relativeClass, String... resourceNames) Create a new GenericXmlApplicationContext, loading bean definitions from the given resource locations and automatically refreshing the context.GenericXmlApplicationContext(String... resourceLocations) Create a new GenericXmlApplicationContext, loading bean definitions from the given resource locations and automatically refreshing the context. -
方法概要
修饰符和类型方法说明final XmlBeanDefinitionReaderExposes the underlyingXmlBeanDefinitionReaderfor additional configuration facilities andloadBeanDefinitionvariations.voidload(cn.taketoday.core.io.Resource... resources) Load bean definitions from the given XML resources.voidLoad bean definitions from the given XML resources.voidLoad bean definitions from the given XML resources.voidsetEnvironment(cn.taketoday.core.env.ConfigurableEnvironment environment) Delegates the given environment to underlyingXmlBeanDefinitionReader.voidsetValidating(boolean validating) Set whether to use XML validation.从类继承的方法 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, 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从接口继承的方法 cn.taketoday.beans.factory.support.BeanDefinitionRegistry
containsBeanDefinition, getBeanDefinitions从接口继承的方法 cn.taketoday.beans.factory.BeanFactory
getBeanNamesForType, unwrap从接口继承的方法 cn.taketoday.context.ConfigurableApplicationContext
addProtocolResolver从接口继承的方法 cn.taketoday.core.io.PatternResourceLoader
getResourcesArray
-
构造器详细资料
-
GenericXmlApplicationContext
public GenericXmlApplicationContext() -
GenericXmlApplicationContext
public GenericXmlApplicationContext(cn.taketoday.core.io.Resource... resources) Create a new GenericXmlApplicationContext, loading bean definitions from the given resources and automatically refreshing the context.- 参数:
resources- the resources to load from
-
GenericXmlApplicationContext
Create a new GenericXmlApplicationContext, loading bean definitions from the given resource locations and automatically refreshing the context.- 参数:
resourceLocations- the resources to load from
-
GenericXmlApplicationContext
Create a new GenericXmlApplicationContext, loading bean definitions from the given resource locations and automatically refreshing the context.- 参数:
relativeClass- class whose package will be used as a prefix when loading each specified resource nameresourceNames- relatively-qualified names of resources to load
-
-
方法详细资料
-
getReader
Exposes the underlyingXmlBeanDefinitionReaderfor additional configuration facilities andloadBeanDefinitionvariations. -
setValidating
public void setValidating(boolean validating) Set whether to use XML validation. Default istrue. -
setEnvironment
public void setEnvironment(cn.taketoday.core.env.ConfigurableEnvironment environment) Delegates the given environment to underlyingXmlBeanDefinitionReader. Should be called before any call to#load.- 指定者:
setEnvironment在接口中ConfigurableApplicationContext- 覆盖:
setEnvironment在类中AbstractApplicationContext- 参数:
environment- the new environment
-
load
public void load(cn.taketoday.core.io.Resource... resources) Load bean definitions from the given XML resources.- 参数:
resources- one or more resources to load from
-
load
Load bean definitions from the given XML resources.- 参数:
resourceLocations- one or more resource locations to load from
-
load
Load bean definitions from the given XML resources.- 参数:
relativeClass- class whose package will be used as a prefix when loading each specified resource nameresourceNames- relatively-qualified names of resources to load
-