Package org.springframework.web.context

# Interface ConfigurableWebApplicationContext

All Superinterfaces:
  `org.springframework.context.ApplicationContext`, `org.springframework.context.ApplicationEventPublisher`, `AutoCloseable`, `org.springframework.beans.factory.BeanFactory`, `Closeable`, `org.springframework.context.ConfigurableApplicationContext`, `org.springframework.core.env.EnvironmentCapable`, `org.springframework.beans.factory.HierarchicalBeanFactory`, `org.springframework.context.Lifecycle`, `org.springframework.beans.factory.ListableBeanFactory`, `org.springframework.context.MessageSource`, `org.springframework.core.io.ResourceLoader`, `org.springframework.core.io.support.ResourcePatternResolver`, `WebApplicationContext`

All Known Implementing Classes:
  `AbstractRefreshableWebApplicationContext`, `AnnotationConfigWebApplicationContext`, `GenericWebApplicationContext`, `GroovyWebApplicationContext`, `StaticWebApplicationContext`, `XmlWebApplicationContext`

public interface ConfigurableWebApplicationContext extends WebApplicationContext, org.springframework.context.ConfigurableApplicationContext
Interface to be implemented by configurable web application contexts. Supported by `ContextLoader` and `org.springframework.web.servlet.FrameworkServlet`.

Note: The setters of this interface need to be called before an invocation of the `ConfigurableApplicationContext.refresh()` method inherited from `ConfigurableApplicationContext`. They do not cause an initialization of the context on their own.

Since:
  05.12.2003
Author:
  Juergen Hoeller
See Also:
  - `ConfigurableApplicationContext.refresh()`
  - `ContextLoader.createWebApplicationContext(jakarta.servlet.ServletContext)`
  - `org.springframework.web.servlet.FrameworkServlet#createWebApplicationContext`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`APPLICATION_CONTEXT_ID_PREFIX`
Prefix for ApplicationContext ids that refer to context path and/or servlet name.
`static final String`
`SERVLET_CONFIG_BEAN_NAME`
Name of the ServletConfig environment bean in the factory.

### Fields inherited from interface org.springframework.beans.factory.BeanFactory

`FACTORY_BEAN_PREFIX, FACTORY_BEAN_PREFIX_CHAR`

### Fields inherited from interface org.springframework.context.ConfigurableApplicationContext

`APPLICATION_STARTUP_BEAN_NAME, BOOTSTRAP_EXECUTOR_BEAN_NAME, CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SHUTDOWN_HOOK_THREAD_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME`

### Fields inherited from interface org.springframework.core.io.ResourceLoader

`CLASSPATH_URL_PREFIX`

### Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver

`CLASSPATH_ALL_URL_PREFIX`

### Fields inherited from interface org.springframework.web.context.WebApplicationContext

`CONTEXT_ATTRIBUTES_BEAN_NAME, CONTEXT_PARAMETERS_BEAN_NAME, ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_APPLICATION, SCOPE_REQUEST, SCOPE_SESSION, SERVLET_CONTEXT_BEAN_NAME`

## Method Summary

Modifier and Type
Method
Description
`String[]`
`getConfigLocations()`
Return the config locations for this web application context, or `null` if none specified.
`String`
`getNamespace()`
Return the namespace for this web application context, if any.
`ServletConfig`
`getServletConfig()`
Return the ServletConfig for this web application context, if any.
`void`
`setConfigLocation(String configLocation)`
Set the config locations for this web application context in init-param style, i.e.
`void`
`setConfigLocations(String... configLocations)`
Set the config locations for this web application context.
`void`
`setNamespace(String namespace)`
Set the namespace for this web application context, to be used for building a default context config location.
`void`
`setServletConfig(ServletConfig servletConfig)`
Set the ServletConfig for this web application context.
`void`
`setServletContext(ServletContext servletContext)`
Set the ServletContext for this web application context.

### Methods inherited from interface org.springframework.context.ApplicationContext

`getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate`

### Methods inherited from interface org.springframework.context.ApplicationEventPublisher

`publishEvent, publishEvent`

### Methods inherited from interface org.springframework.beans.factory.BeanFactory

`containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatch`

### Methods inherited from interface org.springframework.context.ConfigurableApplicationContext

`addApplicationListener, addBeanFactoryPostProcessor, addProtocolResolver, close, getApplicationStartup, getBeanFactory, getEnvironment, isActive, isClosed, refresh, registerShutdownHook, removeApplicationListener, setApplicationStartup, setClassLoader, setEnvironment, setId, setParent`

### Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory

`containsLocalBean, getParentBeanFactory`

### Methods inherited from interface org.springframework.context.Lifecycle

`isRunning, start, stop`

### Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory

`containsBeanDefinition, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation`

### Methods inherited from interface org.springframework.context.MessageSource

`getMessage, getMessage, getMessage`

### Methods inherited from interface org.springframework.core.io.ResourceLoader

`getClassLoader, getResource`

### Methods inherited from interface org.springframework.core.io.support.ResourcePatternResolver

`getResources`

### Methods inherited from interface org.springframework.web.context.WebApplicationContext

`getServletContext`

## Field Details

### APPLICATION_CONTEXT_ID_PREFIX

static final String APPLICATION_CONTEXT_ID_PREFIX
Prefix for ApplicationContext ids that refer to context path and/or servlet name.

### SERVLET_CONFIG_BEAN_NAME

static final String SERVLET_CONFIG_BEAN_NAME
Name of the ServletConfig environment bean in the factory.

See Also:
  - `ServletConfig`
  - Constant Field Values

## Method Details

### setServletContext

void setServletContext(@Nullable ServletContext servletContext)
Set the ServletContext for this web application context.

Does not cause an initialization of the context: refresh needs to be called after the setting of all configuration properties.

See Also:
  - `ConfigurableApplicationContext.refresh()`

### setServletConfig

void setServletConfig(@Nullable ServletConfig servletConfig)
Set the ServletConfig for this web application context. Only called for a WebApplicationContext that belongs to a specific Servlet.

See Also:
  - `ConfigurableApplicationContext.refresh()`

### getServletConfig

@Nullable ServletConfig getServletConfig()
Return the ServletConfig for this web application context, if any.

### setNamespace

void setNamespace(@Nullable String namespace)
Set the namespace for this web application context, to be used for building a default context config location. The root web application context does not have a namespace.

### getNamespace

@Nullable String getNamespace()
Return the namespace for this web application context, if any.

### setConfigLocation

void setConfigLocation(String configLocation)
Set the config locations for this web application context in init-param style, i.e. with distinct locations separated by commas, semicolons or whitespace.

If not set, the implementation is supposed to use a default for the given namespace or the root web application context, as appropriate.

### setConfigLocations

void setConfigLocations(String... configLocations)
Set the config locations for this web application context.

If not set, the implementation is supposed to use a default for the given namespace or the root web application context, as appropriate.

### getConfigLocations

@Nullable String[] getConfigLocations()
Return the config locations for this web application context, or `null` if none specified.