类 GenericXmlApplicationContext

java.lang.Object
cn.taketoday.core.io.DefaultResourceLoader
所有已实现的接口:
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

public class GenericXmlApplicationContext extends GenericApplicationContext
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
另请参阅:
  • 构造器详细资料

    • GenericXmlApplicationContext

      public GenericXmlApplicationContext()
      Create a new GenericXmlApplicationContext that needs to be loaded and then manually refreshed.
    • 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

      public GenericXmlApplicationContext(String... resourceLocations)
      Create a new GenericXmlApplicationContext, loading bean definitions from the given resource locations and automatically refreshing the context.
      参数:
      resourceLocations - the resources to load from
    • GenericXmlApplicationContext

      public GenericXmlApplicationContext(Class<?> relativeClass, String... resourceNames)
      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 name
      resourceNames - relatively-qualified names of resources to load
  • 方法详细资料

    • getReader

      public final XmlBeanDefinitionReader getReader()
      Exposes the underlying XmlBeanDefinitionReader for additional configuration facilities and loadBeanDefinition variations.
    • setValidating

      public void setValidating(boolean validating)
      Set whether to use XML validation. Default is true.
    • setEnvironment

      public void setEnvironment(cn.taketoday.core.env.ConfigurableEnvironment environment)
      Delegates the given environment to underlying XmlBeanDefinitionReader. 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

      public void load(String... resourceLocations)
      Load bean definitions from the given XML resources.
      参数:
      resourceLocations - one or more resource locations to load from
    • load

      public void load(Class<?> relativeClass, String... resourceNames)
      Load bean definitions from the given XML resources.
      参数:
      relativeClass - class whose package will be used as a prefix when loading each specified resource name
      resourceNames - relatively-qualified names of resources to load