References Deprecated
ThemeSource is deprecated or references (maybe indirectly) at least one deprecated element.
See corresponding docs for further information.
GenericApplicationContext, suitable for web environments.
Implements ConfigurableWebApplicationContext, but is not intended for
declarative setup in web.xml. Instead, it is designed for programmatic setup,
for example for building nested contexts or for use within
WebApplicationInitializers.
Interprets resource paths as servlet context resources, i.e. as paths beneath
the web application root. Absolute paths — for example, for files outside
the web app root — can be accessed via file: URLs, as implemented
by AbstractApplicationContext.
In addition to the special beans detected by
AbstractApplicationContext,
this class detects a ThemeSource bean in the context, with the name "themeSource".
Theme support is deprecated as of 6.0 with no direct replacement.
If you wish to register annotated component classes with a
GenericWebApplicationContext, you can use an
AnnotatedBeanDefinitionReader, as demonstrated in the following example.
Component classes include in particular
@Configuration
classes but also plain @Component
classes as well as JSR-330 compliant classes using jakarta.inject annotations.
GenericWebApplicationContext context = new GenericWebApplicationContext(); AnnotatedBeanDefinitionReader reader = new AnnotatedBeanDefinitionReader(context); reader.register(AppConfig.class, UserController.class, UserRepository.class);
If you intend to implement a WebApplicationContext that reads bean definitions
from configuration files, consider deriving from AbstractRefreshableWebApplicationContext,
reading the bean definitions in an implementation of the loadBeanDefinitions
method.
| Modifier and Type | Field and Description |
|---|---|
| private ServletContext | |
| private ThemeSource | themeSource
References Deprecated
ThemeSource is deprecated or references (maybe indirectly) at least one deprecated element.
|
| Access | Constructor and Description |
|---|---|
| public | |
| public | GenericWebApplicationContext(ServletContext
the servletContext)ServletContext to run inCreate a new |
| public | GenericWebApplicationContext(DefaultListableBeanFactory
the beanFactory)DefaultListableBeanFactory instance to use for this contextCreate a new |
| public | GenericWebApplicationContext(DefaultListableBeanFactory
the beanFactory, ServletContext DefaultListableBeanFactory instance to use for this contextthe servletContext)ServletContext to run inCreate a new |
| servletContext | back to summary |
|---|---|
| private ServletContext servletContext
| |
| themeSource | back to summary |
|---|---|
| private ThemeSource themeSource
References Deprecated
See corresponding docs for further information. | |
| GenericWebApplicationContext | back to summary |
|---|---|
| public GenericWebApplicationContext() Create a new
| |
| GenericWebApplicationContext | back to summary |
|---|---|
| public GenericWebApplicationContext(ServletContext servletContext) Create a new
| |
| GenericWebApplicationContext | back to summary |
|---|---|
| public GenericWebApplicationContext(DefaultListableBeanFactory beanFactory) Create a new
| |
| GenericWebApplicationContext | back to summary |
|---|---|
| public GenericWebApplicationContext(DefaultListableBeanFactory beanFactory, ServletContext servletContext) Create a new
| |
| createEnvironment | back to summary |
|---|---|
| protected ConfigurableEnvironment createEnvironment() Overrides org. Create and return a new
| |
| getApplicationName | back to summary |
|---|---|
| public String getApplicationName() Overrides org. Implements org. Doc from org. Return a name for the deployed application that this context belongs to. | |
| getConfigLocations | back to summary |
|---|---|
| public String[] getConfigLocations() Implements org. Doc from org. Return the config locations for this web application context,
or
| |
| getNamespace | back to summary |
|---|---|
| public String getNamespace() Implements org. Doc from org. Return the namespace for this web application context, if any. | |
| getResourceByPath | back to summary |
|---|---|
| protected Resource getResourceByPath(String path) Overrides org. This implementation supports file paths beneath the root of the
| |
| getResourcePatternResolver | back to summary |
|---|---|
| protected ResourcePatternResolver getResourcePatternResolver() Overrides org. This implementation supports pattern matching in unexpanded WARs too.
| |
| getServletConfig | back to summary |
|---|---|
| public ServletConfig getServletConfig() Implements org. Doc from org. Return the ServletConfig for this web application context, if any. | |
| getServletContext | back to summary |
|---|---|
| public ServletContext getServletContext() Implements org. Doc from org. Return the standard Servlet API ServletContext for this application. | |
| getTheme | back to summary |
|---|---|
| public Theme getTheme(String themeName) Implements org. Doc from org. Deprecated
Return the Theme instance for the given theme name. The returned Theme will resolve theme-specific messages, codes, file paths, etc (e.g. CSS and image files in a web environment).
| |
| initPropertySources | back to summary |
|---|---|
| protected void initPropertySources() Overrides org. Doc from org. Replace any stub property sources with actual instances. Replace
| |
| onRefresh | back to summary |
|---|---|
| protected void onRefresh() Overrides org. Initialize the theme capability.
| |
| postProcessBeanFactory | back to summary |
|---|---|
| protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) Overrides org. Register request/session scopes, environment beans, a
| |
| setConfigLocation | back to summary |
|---|---|
| public void setConfigLocation(String configLocation) Implements org. Doc from org. 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 | back to summary |
|---|---|
| public void setConfigLocations(String... configLocations) Implements org. Doc from org. 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.
| |
| setNamespace | back to summary |
|---|---|
| public void setNamespace(String namespace) Implements org. Doc from org. 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.
| |
| setServletConfig | back to summary |
|---|---|
| public void setServletConfig(ServletConfig servletConfig) Implements org. Doc from org. Set the ServletConfig for this web application context. Only called for a WebApplicationContext that belongs to a specific Servlet.
| |
| setServletContext | back to summary |
|---|---|
| public void setServletContext(ServletContext servletContext) Implements org. Set the
| |