org.springframework.context.support
Class ClassPathXmlApplicationContext

org.springframework.context.support.AbstractApplicationContext
  |
  +--org.springframework.context.support.AbstractXmlApplicationContext
        |
        +--org.springframework.context.support.FileSystemXmlApplicationContext
              |
              +--org.springframework.context.support.ClassPathXmlApplicationContext

public class ClassPathXmlApplicationContext
extends FileSystemXmlApplicationContext

Standalone XML application context, taking the context definition files from the class path. Mainly useful for test harnesses, but also for application contexts embedded within JARs.

Note: Generally treats (file) paths as class path resources, when using ApplicationContext.getResource. Only supports full classpath resource names that include the package path, like "mypackage/myresource.dat".

Author:
Rod Johnson, Juergen Hoeller
See Also: AbstractApplicationContext.getResource(java.lang.String), getResourceByPath(java.lang.String)

Fields inherited from class org.springframework.context.support.AbstractApplicationContext
MESSAGE_SOURCE_BEAN_NAME

Constructor Summary
ClassPathXmlApplicationContext(String configLocation)
          Create a new ClassPathXmlApplicationContext, loading the definitions from the given XML file.
ClassPathXmlApplicationContext(String[] configLocations)
          Create a new ClassPathXmlApplicationContext, loading the definitions from the given XML files.
ClassPathXmlApplicationContext(String[] configLocations, ApplicationContext parent)
          Create a new ClassPathXmlApplicationContext with the given parent, loading the definitions from the given XML files.

Methods inherited from class org.springframework.context.support.AbstractXmlApplicationContext
getBeanFactory

Methods inherited from class org.springframework.context.support.AbstractApplicationContext
close, containsBean, containsBeanDefinition, getAliases, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getBeansOfType, getDisplayName, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResource, getStartupDate, isSingleton, publishEvent, refresh, setParent, toString

Constructor Detail

ClassPathXmlApplicationContext

public ClassPathXmlApplicationContext(String configLocation)
throws org.springframework.beans.BeansException
Create a new ClassPathXmlApplicationContext, loading the definitions from the given XML file.
Parameters:
configLocation - file path

ClassPathXmlApplicationContext

public ClassPathXmlApplicationContext(String[] configLocations)
throws org.springframework.beans.BeansException
Create a new ClassPathXmlApplicationContext, loading the definitions from the given XML files.
Parameters:
configLocations - array of file paths

ClassPathXmlApplicationContext

public ClassPathXmlApplicationContext(String[] configLocations, ApplicationContext parent)
throws org.springframework.beans.BeansException
Create a new ClassPathXmlApplicationContext with the given parent, loading the definitions from the given XML files.
Parameters:
configLocations - array of file paths
parent - the parent context