Interface ThreadContextPopulator

All Superinterfaces:
org.springframework.beans.factory.InitializingBean
All Known Implementing Classes:
BuildInfoThreadContextPopulator, UserDetailsThreadContextPopulator

public interface ThreadContextPopulator extends org.springframework.beans.factory.InitializingBean
Interface for populating the Log4j ThreadContext with custom information.

Each populator implementation is responsible for populating a key. It may be done immediately in populate() or at a later time.

Author:
poirigui
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Recommended prefix to use to organize ThreadContext keys,
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
     
    Key in the ThreadContext this populator is responsible for.
    void
    Populate the ThreadContext.
  • Field Details

    • KEY_PREFIX

      static final String KEY_PREFIX
      Recommended prefix to use to organize ThreadContext keys,
      See Also:
  • Method Details

    • getKey

      String getKey()
      Key in the ThreadContext this populator is responsible for.
    • populate

      void populate()
      Populate the ThreadContext.

      This is called when the bean is initialized as per InitializingBean.afterPropertiesSet().

    • afterPropertiesSet

      default void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception