Top Description Fields Constructors Methods
org.springframework.context.support

public abstract Class AbstractRefreshableConfigApplicationContext

extends AbstractRefreshableApplicationContext
implements BeanNameAware, InitializingBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.Aware
Known Direct Subclasses
org.springframework.context.support.AbstractXmlApplicationContext
Imports
org.springframework.beans.factory.BeanNameAware, .InitializingBean, org.springframework.context.ApplicationContext, org.springframework.lang.Nullable, org.springframework.util.Assert, .StringUtils

AbstractRefreshableApplicationContext subclass that adds common handling of specified config locations. Serves as base class for XML-based application context implementations such as ClassPathXmlApplicationContext and FileSystemXmlApplicationContext, as well as org.springframework.web.context.support.XmlWebApplicationContext.
Author
Juergen Hoeller
Since
2.5.2
See Also
setConfigLocation, setConfigLocations, getDefaultConfigLocations

Field Summary

Modifier and TypeField and Description
private String[]
private boolean

Constructor Summary

AccessConstructor and Description
public
AbstractRefreshableConfigApplicationContext()

Create a new AbstractRefreshableConfigApplicationContext with no parent.

public
AbstractRefreshableConfigApplicationContext(ApplicationContext
the parent context
parent
)

Create a new AbstractRefreshableConfigApplicationContext with the given parent context.

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Triggers refresh() if not refreshed in the concrete context's constructor already.

protected String[]

Returns:

an array of resource locations, or null if none
getConfigLocations
()

Return an array of resource locations, referring to the XML bean definition files that this context should be built with.

protected String[]

Returns:

an array of default config locations, if any
getDefaultConfigLocations
()

Return the default config locations to use, for the case where no explicit config locations have been specified.

protected String

Returns:

the resolved file path
resolvePath
(String
the original file path
path
)

Resolve the given path, replacing placeholders with corresponding environment property values if necessary.

public void
setBeanName(String
the name of the bean in the factory. Note that this name is the actual bean name used in the factory, which may differ from the originally specified name: in particular for inner bean names, the actual bean name might have been made unique through appending "#..." suffixes. Use the BeanFactoryUtils#originalBeanName(String) method to extract the original bean name (without suffix), if desired.
name
)

Implements org.springframework.beans.factory.BeanNameAware.setBeanName.

Sets the id of this context to the bean name by default, for cases where the context instance is itself defined as a bean.

public void
setConfigLocation(String location)

Set the config locations for this application context in init-param style, i.e. with distinct locations separated by commas, semicolons or whitespace.

public void
setConfigLocations(String... locations)

Set the config locations for this application context.

public void
setId(String
the unique id of the context
id
)

Overrides org.springframework.context.support.AbstractApplicationContext.setId.

Implements org.springframework.context.ConfigurableApplicationContext.setId.

Set the unique id of this application context.

Inherited from org.springframework.context.support.AbstractRefreshableApplicationContext:
assertBeanFactoryActivecancelRefreshcloseBeanFactorycreateBeanFactorycustomizeBeanFactorygetBeanFactoryhasBeanFactoryloadBeanDefinitionsrefreshBeanFactorysetAllowBeanDefinitionOverridingsetAllowCircularReferences

Field Detail

configLocationsback to summary
private String[] configLocations
Annotations
@Nullable
setIdCalledback to summary
private boolean setIdCalled

Constructor Detail

AbstractRefreshableConfigApplicationContextback to summary
public AbstractRefreshableConfigApplicationContext()

Create a new AbstractRefreshableConfigApplicationContext with no parent.

AbstractRefreshableConfigApplicationContextback to summary
public AbstractRefreshableConfigApplicationContext(ApplicationContext parent)

Create a new AbstractRefreshableConfigApplicationContext with the given parent context.

Parameters
parent:ApplicationContext

the parent context

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Triggers refresh() if not refreshed in the concrete context's constructor already.

Annotations
@Override
getConfigLocationsback to summary
protected String[] getConfigLocations()

Return an array of resource locations, referring to the XML bean definition files that this context should be built with. Can also include location patterns, which will get resolved via a ResourcePatternResolver.

The default implementation returns null. Subclasses can override this to provide a set of resource locations to load bean definitions from.

Returns:String[]

an array of resource locations, or null if none

Annotations
@Nullable
See Also
getResources, getResourcePatternResolver
getDefaultConfigLocationsback to summary
protected String[] getDefaultConfigLocations()

Return the default config locations to use, for the case where no explicit config locations have been specified.

The default implementation returns null, requiring explicit config locations.

Returns:String[]

an array of default config locations, if any

Annotations
@Nullable
See Also
setConfigLocations
resolvePathback to summary
protected String resolvePath(String path)

Resolve the given path, replacing placeholders with corresponding environment property values if necessary. Applied to config locations.

Parameters
path:String

the original file path

Returns:String

the resolved file path

See Also
org.springframework.core.env.Environment#resolveRequiredPlaceholders(String)
setBeanNameback to summary
public void setBeanName(String name)

Implements org.springframework.beans.factory.BeanNameAware.setBeanName.

Sets the id of this context to the bean name by default, for cases where the context instance is itself defined as a bean.

Parameters
name:String

Doc from org.springframework.beans.factory.BeanNameAware.setBeanName.

the name of the bean in the factory. Note that this name is the actual bean name used in the factory, which may differ from the originally specified name: in particular for inner bean names, the actual bean name might have been made unique through appending "#..." suffixes. Use the BeanFactoryUtils#originalBeanName(String) method to extract the original bean name (without suffix), if desired.

Annotations
@Override
setConfigLocationback to summary
public void setConfigLocation(String location)

Set the config locations for this application context in init-param style, i.e. with distinct locations separated by commas, semicolons or whitespace.

If not set, the implementation may use a default as appropriate.

setConfigLocationsback to summary
public void setConfigLocations(String... locations)

Set the config locations for this application context.

If not set, the implementation may use a default as appropriate.

setIdback to summary
public void setId(String id)

Overrides org.springframework.context.support.AbstractApplicationContext.setId.

Implements org.springframework.context.ConfigurableApplicationContext.setId.

Doc from org.springframework.context.support.AbstractApplicationContext.setId.

Set the unique id of this application context.

Default is the object id of the context instance, or the name of the context bean if the context is itself defined as a bean.

Parameters
id:String

the unique id of the context

Annotations
@Override