spring-framework / org.springframework.context.support / ClassPathXmlApplicationContext / <init>

<init>

ClassPathXmlApplicationContext()

Create a new ClassPathXmlApplicationContext for bean-style configuration.

See Also
#setConfigLocation#setConfigLocations#afterPropertiesSet()

ClassPathXmlApplicationContext(parent: ApplicationContext)

Create a new ClassPathXmlApplicationContext for bean-style configuration.

Parameters

parent - the parent context

See Also
#setConfigLocation#setConfigLocations#afterPropertiesSet()

ClassPathXmlApplicationContext(configLocation: String)

Create a new ClassPathXmlApplicationContext, loading the definitions from the given XML file and automatically refreshing the context.

Parameters

configLocation - resource location

Exceptions

BeansException - if context creation failed

ClassPathXmlApplicationContext(vararg configLocations: String)

Create a new ClassPathXmlApplicationContext, loading the definitions from the given XML files and automatically refreshing the context.

Parameters

configLocations - array of resource locations

Exceptions

BeansException - if context creation failed

ClassPathXmlApplicationContext(configLocations: Array<String>, @Nullable parent: ApplicationContext)

Create a new ClassPathXmlApplicationContext with the given parent, loading the definitions from the given XML files and automatically refreshing the context.

Parameters

configLocations - array of resource locations

parent - the parent context

Exceptions

BeansException - if context creation failed

ClassPathXmlApplicationContext(configLocations: Array<String>, refresh: Boolean)

Create a new ClassPathXmlApplicationContext, loading the definitions from the given XML files.

Parameters

configLocations - array of resource locations

refresh - whether to automatically refresh the context, loading all bean definitions and creating all singletons. Alternatively, call refresh manually after further configuring the context.

Exceptions

BeansException - if context creation failed

See Also
#refresh()

ClassPathXmlApplicationContext(configLocations: Array<String>, refresh: Boolean, @Nullable parent: ApplicationContext)

Create a new ClassPathXmlApplicationContext with the given parent, loading the definitions from the given XML files.

Parameters

configLocations - array of resource locations

refresh - whether to automatically refresh the context, loading all bean definitions and creating all singletons. Alternatively, call refresh manually after further configuring the context.

parent - the parent context

Exceptions

BeansException - if context creation failed

See Also
#refresh()

ClassPathXmlApplicationContext(path: String, clazz: Class<*>)

Create a new ClassPathXmlApplicationContext, loading the definitions from the given XML file and automatically refreshing the context.

This is a convenience method to load class path resources relative to a given Class. For full flexibility, consider using a GenericApplicationContext with an XmlBeanDefinitionReader and a ClassPathResource argument.

Parameters

path - relative (or absolute) path within the class path

clazz - the class to load resources with (basis for the given paths)

Exceptions

BeansException - if context creation failed

See Also
org.springframework.core.io.ClassPathResource#ClassPathResource(String, Class)org.springframework.context.support.GenericApplicationContextorg.springframework.beans.factory.xml.XmlBeanDefinitionReader

ClassPathXmlApplicationContext(paths: Array<String>, clazz: Class<*>)

Create a new ClassPathXmlApplicationContext, loading the definitions from the given XML files and automatically refreshing the context.

Parameters

paths - array of relative (or absolute) paths within the class path

clazz - the class to load resources with (basis for the given paths)

Exceptions

BeansException - if context creation failed

See Also
org.springframework.core.io.ClassPathResource#ClassPathResource(String, Class)org.springframework.context.support.GenericApplicationContextorg.springframework.beans.factory.xml.XmlBeanDefinitionReader

ClassPathXmlApplicationContext(paths: Array<String>, clazz: Class<*>, @Nullable parent: ApplicationContext)

Create a new ClassPathXmlApplicationContext with the given parent, loading the definitions from the given XML files and automatically refreshing the context.

Parameters

paths - array of relative (or absolute) paths within the class path

clazz - the class to load resources with (basis for the given paths)

parent - the parent context

Exceptions

BeansException - if context creation failed

See Also
org.springframework.core.io.ClassPathResource#ClassPathResource(String, Class)org.springframework.context.support.GenericApplicationContextorg.springframework.beans.factory.xml.XmlBeanDefinitionReader