类 ServletContextAttributeFactoryBean

java.lang.Object
cn.taketoday.web.servlet.support.ServletContextAttributeFactoryBean
所有已实现的接口:
cn.taketoday.beans.factory.Aware, cn.taketoday.beans.factory.FactoryBean<Object>, ServletContextAware

public class ServletContextAttributeFactoryBean extends Object implements cn.taketoday.beans.factory.FactoryBean<Object>, ServletContextAware
FactoryBean that fetches a specific, existing ServletContext attribute. Exposes that ServletContext attribute when used as bean reference, effectively making it available as named Framework bean instance.

Intended to link in ServletContext attributes that exist before the startup of the Framework application context. Typically, such attributes will have been put there by third-party web frameworks. In a purely Framework-based web application, no such linking in of ServletContext attributes will be necessary.

NOTE:you may also use the "contextAttributes" default bean which is of type Map, and dereference it using an "#{contextAttributes.myKey}" expression to access a specific attribute by name.

从以下版本开始:
4.0
作者:
Juergen Hoeller
另请参阅:
  • 字段详细资料

    • attributeName

      @Nullable private String attributeName
    • attribute

      @Nullable private Object attribute
  • 构造器详细资料

    • ServletContextAttributeFactoryBean

      public ServletContextAttributeFactoryBean()
  • 方法详细资料

    • setAttributeName

      public void setAttributeName(@Nullable String attributeName)
      Set the name of the ServletContext attribute to expose.
    • setServletContext

      public void setServletContext(ServletContext servletContext)
      从接口复制的说明: ServletContextAware
      Set the 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 在接口中 ServletContextAware
      参数:
      servletContext - the ServletContext object to be used by this object
      另请参阅:
      • InitializingBean.afterPropertiesSet()
      • ApplicationContextAware.setApplicationContext(cn.taketoday.context.ApplicationContext)
    • getObject

      @Nullable public Object getObject() throws Exception
      指定者:
      getObject 在接口中 cn.taketoday.beans.factory.FactoryBean<Object>
      抛出:
      Exception
    • getObjectType

      public Class<?> getObjectType()
      指定者:
      getObjectType 在接口中 cn.taketoday.beans.factory.FactoryBean<Object>
    • isSingleton

      public boolean isSingleton()
      指定者:
      isSingleton 在接口中 cn.taketoday.beans.factory.FactoryBean<Object>