org.springframework.web.context.support
public class: ServletContextFactoryBean [javadoc |
source]
java.lang.Object
org.springframework.web.context.support.ServletContextFactoryBean
All Implemented Interfaces:
ServletContextAware, FactoryBean
Simple 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.
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.springframework.web.context.support.ServletContextFactoryBean Detail: |
public Object getObject() {
return this.servletContext;
}
|
public Class getObjectType() {
return (this.servletContext != null ? this.servletContext.getClass() : ServletContext.class);
}
|
public boolean isSingleton() {
return true;
}
|
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
}
|