类 ServletContextAttributeExporter

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

public class ServletContextAttributeExporter extends Object implements ServletContextAware
Exporter that takes Frameworkdefined objects and exposes them as ServletContext attributes. Usually, bean references will be used to export Framework-defined beans as ServletContext attributes.

Useful to make Frameworkdefined beans available to code that is not aware of Framework at all, but rather just of the Servlet API. Client code can then use plain ServletContext attribute lookups to access those objects, despite them being defined in a Framework application context.

Alternatively, consider using the WebApplicationContextUtils class to access Framework-defined beans via the WebServletApplicationContext interface. This makes client code aware of Framework API, of course.

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

    • logger

      protected final cn.taketoday.logging.Logger logger
    • attributes

      @Nullable private Map<String,Object> attributes
  • 构造器详细资料

    • ServletContextAttributeExporter

      public ServletContextAttributeExporter()
  • 方法详细资料

    • setAttributes

      public void setAttributes(@Nullable Map<String,Object> attributes)
      Set the ServletContext attributes to expose as key-value pairs. Each key will be considered a ServletContext attributes key, and each value will be used as corresponding attribute value.

      Usually, you will use bean references for the values, to export Frameworkdefined beans as ServletContext attributes. Of course, it is also possible to define plain values to export.

    • 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)