Annotation Interface OfLog4jContext
On the client side, applied to a parameter on a ByJms interface, it specifies the key and value for ThreadContext.
On the server side, applied to a parameter of a ForJmsType Invoking method, it specifies the supplier parameter for the value of the named context.
When applied to a parameter, the context value will be supplied by the argument via Object.toString().
The annotation can also be applied to a supplier method defined by the type of the body parameter on either the client side and the server side. The supplier method must
- be declared on the type directly, no recursion or inheritance
public- have no parameter
- return a value
null, will be converted to
String via Object.toString(). If no name is
specified by the annotation, the method name will be used as the context key.
Note that there is only one ThreadContext for each thread. If there is an existing context on the thread, it will be overwritten by the new value from the annotation. After execution, the all keys will be removed resulting the lose of the original values.
In case of a name collision, the following defines the precedence from high to low:
- supplier methods from body argument
- body argument itself
- other arguments, e.g., headers and properties
- Since:
- 2.3.1
- Author:
- Lei Yang
- See Also:
-
Nested Class Summary
Nested Classes -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionSpecifies the operation of the annotation.Specifies the name of the ThreadContext.
-
Element Details
-
value
String valueSpecifies the name of the ThreadContext.When no value is specified, the context name is inferred from the parameter name. For this to work properly, '
-parameters' compiler option is desired.- Default:
- ""
-
op
Specifies the operation of the annotation.- Default:
- Default
-