public abstract class

AbstractRefreshableConfigApplicationContext

extends AbstractRefreshableApplicationContext
implements BeanNameAware InitializingBean
java.lang.Object
   ↳ org.springframework.core.io.DefaultResourceLoader
     ↳ org.springframework.context.support.AbstractApplicationContext
       ↳ org.springframework.context.support.AbstractRefreshableApplicationContext
         ↳ org.springframework.context.support.AbstractRefreshableConfigApplicationContext
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

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 XmlWebApplicationContext and XmlPortletApplicationContext.

Summary

[Expand]
Inherited Constants
From class org.springframework.context.support.AbstractApplicationContext
From interface org.springframework.beans.factory.BeanFactory
From interface org.springframework.context.ConfigurableApplicationContext
From interface org.springframework.core.io.ResourceLoader
From interface org.springframework.core.io.support.ResourcePatternResolver
[Expand]
Inherited Fields
From class org.springframework.context.support.AbstractApplicationContext
Public Constructors
AbstractRefreshableConfigApplicationContext()
Create a new AbstractRefreshableConfigApplicationContext with no parent.
AbstractRefreshableConfigApplicationContext(ApplicationContext parent)
Create a new AbstractRefreshableConfigApplicationContext with the given parent context.
Public Methods
void afterPropertiesSet()
Triggers refresh() if not refreshed in the concrete context's constructor already.
void setBeanName(String name)
Sets the id of this context to the bean name by default, for cases where the context instance is itself defined as a bean.
void setConfigLocation(String location)
Set the config locations for this application context in init-param style, i.e.
void setConfigLocations(String[] locations)
Set the config locations for this application context.
void setId(String id)
Set the unique id of this application context.
Protected Methods
String[] getConfigLocations()
Return an array of resource locations, referring to the XML bean definition files that this context should be built with.
String[] getDefaultConfigLocations()
Return the default config locations to use, for the case where no explicit config locations have been specified.
String resolvePath(String path)
Resolve the given path, replacing placeholders with corresponding system property values if necessary.
[Expand]
Inherited Methods
From class org.springframework.context.support.AbstractRefreshableApplicationContext
From class org.springframework.context.support.AbstractApplicationContext
From class org.springframework.core.io.DefaultResourceLoader
From class java.lang.Object
From interface org.springframework.beans.factory.BeanFactory
From interface org.springframework.beans.factory.BeanNameAware
From interface org.springframework.beans.factory.DisposableBean
From interface org.springframework.beans.factory.HierarchicalBeanFactory
From interface org.springframework.beans.factory.InitializingBean
From interface org.springframework.beans.factory.ListableBeanFactory
From interface org.springframework.context.ApplicationContext
From interface org.springframework.context.ApplicationEventPublisher
From interface org.springframework.context.ConfigurableApplicationContext
From interface org.springframework.context.Lifecycle
From interface org.springframework.context.MessageSource
From interface org.springframework.core.env.EnvironmentCapable
From interface org.springframework.core.io.ResourceLoader
From interface org.springframework.core.io.support.ResourcePatternResolver

Public Constructors

public AbstractRefreshableConfigApplicationContext ()

Create a new AbstractRefreshableConfigApplicationContext with no parent.

public AbstractRefreshableConfigApplicationContext (ApplicationContext parent)

Create a new AbstractRefreshableConfigApplicationContext with the given parent context.

Parameters
parent the parent context

Public Methods

public void afterPropertiesSet ()

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

public void setBeanName (String name)

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 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.

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.

public void setConfigLocations (String[] locations)

Set the config locations for this application context.

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

public void setId (String id)

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 the unique id of the context

Protected Methods

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
  • an array of resource locations, or null if none

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
  • an array of default config locations, if any

protected String resolvePath (String path)

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

Parameters
path the original file path
Returns
  • the resolved file path