Home / Class/ CorrelationIdConverter Class — spring-boot Architecture

CorrelationIdConverter Class — spring-boot Architecture

Architecture documentation for the CorrelationIdConverter class in CorrelationIdConverter.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/CorrelationIdConverter.java lines 41–70

@Plugin(name = "CorrelationIdConverter", category = PatternConverter.CATEGORY)
@ConverterKeys("correlationId")
@PerformanceSensitive("allocation")
public final class CorrelationIdConverter extends LogEventPatternConverter {

	private final CorrelationIdFormatter formatter;

	private CorrelationIdConverter(CorrelationIdFormatter formatter) {
		super("correlationId{%s}".formatted(formatter), "mdc");
		this.formatter = formatter;
	}

	@Override
	public void format(LogEvent event, StringBuilder toAppendTo) {
		ReadOnlyStringMap contextData = event.getContextData();
		this.formatter.formatTo(contextData::getValue, toAppendTo);
	}

	/**
	 * Factory method to create a new {@link CorrelationIdConverter}.
	 * @param options options, may be null or first element contains name of property to
	 * format.
	 * @return instance of PropertiesPatternConverter.
	 */
	public static CorrelationIdConverter newInstance(String @Nullable [] options) {
		String pattern = (!ObjectUtils.isEmpty(options)) ? options[0] : null;
		return new CorrelationIdConverter(CorrelationIdFormatter.of(pattern));
	}

}

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free