@Deprecated public class ServletContextFactoryBean extends Object implements org.springframework.beans.factory.FactoryBean<ServletContext>, ServletContextAware
FactoryBean
that exposes the ServletContext for bean references.
Can be used as alternative to implementing the ServletContextAware
callback interface. Allows for passing the ServletContext reference
to a constructor argument or any custom bean property.
Note that there's a special FactoryBean for exposing a specific ServletContext attribute, named ServletContextAttributeFactoryBean. So if all you need from the ServletContext is access to a specific attribute, ServletContextAttributeFactoryBean allows you to expose a constructor argument or bean property of the attribute type, which is a preferable to a dependency on the full ServletContext.
ServletContext
,
ServletContextAware
,
ServletContextAttributeFactoryBean
,
WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME
Constructor and Description |
---|
ServletContextFactoryBean()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
ServletContext |
getObject()
Deprecated.
|
Class<? extends ServletContext> |
getObjectType()
Deprecated.
|
boolean |
isSingleton()
Deprecated.
|
void |
setServletContext(ServletContext servletContext)
Deprecated.
Set the
ServletContext that this object runs in. |
public void setServletContext(ServletContext servletContext)
ServletContextAware
ServletContext
that this object runs in.
Invoked after population of normal bean properties but before an init
callback like InitializingBean's afterPropertiesSet
or a
custom init-method. Invoked after ApplicationContextAware's
setApplicationContext
.
setServletContext
in interface ServletContextAware
servletContext
- ServletContext object to be used by this objectInitializingBean.afterPropertiesSet()
,
ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)
public ServletContext getObject()
getObject
in interface org.springframework.beans.factory.FactoryBean<ServletContext>
public Class<? extends ServletContext> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<ServletContext>
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean<ServletContext>