Package org.springframework.http.codec

# Interface CodecConfigurer.DefaultCodecs

All Known Subinterfaces:
  `ClientCodecConfigurer.ClientDefaultCodecs`, `ServerCodecConfigurer.ServerDefaultCodecs`

Enclosing interface:
  CodecConfigurer

public static interface CodecConfigurer.DefaultCodecs
Customize or replace the HTTP message readers and writers registered by default. The options are further extended by `ClientDefaultCodecs` and `ServerDefaultCodecs`.

## Method Summary

Modifier and Type
Method
Description
`void`
`configureDefaultCodec(Consumer<Object> codecConsumer)`
Register a consumer to apply to default config instances.
`void`
`enableLoggingRequestDetails(boolean enable)`
Whether to log form data at DEBUG level, and headers at TRACE level.
`void`
`jackson2JsonDecoder(org.springframework.core.codec.Decoder<?> decoder)`
Override the default Jackson JSON `Decoder`.
`void`
`jackson2JsonEncoder(org.springframework.core.codec.Encoder<?> encoder)`
Override the default Jackson JSON `Encoder`.
`void`
`jackson2SmileDecoder(org.springframework.core.codec.Decoder<?> decoder)`
Override the default Jackson Smile `Decoder`.
`void`
`jackson2SmileEncoder(org.springframework.core.codec.Encoder<?> encoder)`
Override the default Jackson Smile `Encoder`.
`void`
`jaxb2Decoder(org.springframework.core.codec.Decoder<?> decoder)`
Override the default JAXB2 `Decoder`.
`void`
`jaxb2Encoder(org.springframework.core.codec.Encoder<?> encoder)`
Override the default JABX2 `Encoder`.
`void`
`kotlinSerializationCborDecoder(org.springframework.core.codec.Decoder<?> decoder)`
Override the default Kotlin Serialization CBOR `Decoder`.
`void`
`kotlinSerializationCborEncoder(org.springframework.core.codec.Encoder<?> encoder)`
Override the default Kotlin Serialization CBOR `Encoder`.
`void`
`kotlinSerializationJsonDecoder(org.springframework.core.codec.Decoder<?> decoder)`
Override the default Kotlin Serialization JSON `Decoder`.
`void`
`kotlinSerializationJsonEncoder(org.springframework.core.codec.Encoder<?> encoder)`
Override the default Kotlin Serialization JSON `Encoder`.
`void`
`kotlinSerializationProtobufDecoder(org.springframework.core.codec.Decoder<?> decoder)`
Override the default Kotlin Serialization Protobuf `Decoder`.
`void`
`kotlinSerializationProtobufEncoder(org.springframework.core.codec.Encoder<?> encoder)`
Override the default Kotlin Serialization Protobuf `Encoder`.
`void`
`maxInMemorySize(int byteCount)`
Configure a limit on the number of bytes that can be buffered whenever the input stream needs to be aggregated.
`CodecConfigurer.MultipartCodecs`
`multipartCodecs()`
Configure encoders or writers for use with `MultipartHttpMessageWriter`.
`void`
`multipartReader(HttpMessageReader<?> reader)`
Configure the `HttpMessageReader` to use for multipart requests.
`void`
`protobufDecoder(org.springframework.core.codec.Decoder<?> decoder)`
Override the default Protobuf `Decoder`.
`void`
`protobufEncoder(org.springframework.core.codec.Encoder<?> encoder)`
Override the default Protobuf `Encoder`.

## Method Details

### jackson2JsonDecoder

void jackson2JsonDecoder(org.springframework.core.codec.Decoder<?> decoder)
Override the default Jackson JSON `Decoder`.

Note that `maxInMemorySize(int)`, if configured, will be applied to the given decoder.

Parameters:
  `decoder` - the decoder instance to use
See Also:
  - `Jackson2JsonDecoder`

### jackson2JsonEncoder

void jackson2JsonEncoder(org.springframework.core.codec.Encoder<?> encoder)
Override the default Jackson JSON `Encoder`.

Parameters:
  `encoder` - the encoder instance to use
See Also:
  - `Jackson2JsonEncoder`

### jackson2SmileDecoder

void jackson2SmileDecoder(org.springframework.core.codec.Decoder<?> decoder)
Override the default Jackson Smile `Decoder`.

Note that `maxInMemorySize(int)`, if configured, will be applied to the given decoder.

Parameters:
  `decoder` - the decoder instance to use
See Also:
  - `Jackson2SmileDecoder`

### jackson2SmileEncoder

void jackson2SmileEncoder(org.springframework.core.codec.Encoder<?> encoder)
Override the default Jackson Smile `Encoder`.

Parameters:
  `encoder` - the encoder instance to use
See Also:
  - `Jackson2SmileEncoder`

### protobufDecoder

void protobufDecoder(org.springframework.core.codec.Decoder<?> decoder)
Override the default Protobuf `Decoder`.

Note that `maxInMemorySize(int)`, if configured, will be applied to the given decoder.

Parameters:
  `decoder` - the decoder instance to use
Since:
  5.1
See Also:
  - `ProtobufDecoder`

### protobufEncoder

void protobufEncoder(org.springframework.core.codec.Encoder<?> encoder)
Override the default Protobuf `Encoder`.

Parameters:
  `encoder` - the encoder instance to use
Since:
  5.1
See Also:
  - `ProtobufEncoder`
  - `ProtobufHttpMessageWriter`

### jaxb2Decoder

void jaxb2Decoder(org.springframework.core.codec.Decoder<?> decoder)
Override the default JAXB2 `Decoder`.

Note that `maxInMemorySize(int)`, if configured, will be applied to the given decoder.

Parameters:
  `decoder` - the decoder instance to use
Since:
  5.1.3
See Also:
  - `Jaxb2XmlDecoder`

### jaxb2Encoder

void jaxb2Encoder(org.springframework.core.codec.Encoder<?> encoder)
Override the default JABX2 `Encoder`.

Parameters:
  `encoder` - the encoder instance to use
Since:
  5.1.3
See Also:
  - `Jaxb2XmlEncoder`

### kotlinSerializationCborDecoder

void kotlinSerializationCborDecoder(org.springframework.core.codec.Decoder<?> decoder)
Override the default Kotlin Serialization CBOR `Decoder`.

Parameters:
  `decoder` - the decoder instance to use
Since:
  6.0
See Also:
  - `KotlinSerializationCborDecoder`

### kotlinSerializationCborEncoder

void kotlinSerializationCborEncoder(org.springframework.core.codec.Encoder<?> encoder)
Override the default Kotlin Serialization CBOR `Encoder`.

Parameters:
  `encoder` - the encoder instance to use
Since:
  6.0
See Also:
  - `KotlinSerializationCborDecoder`

### kotlinSerializationJsonDecoder

void kotlinSerializationJsonDecoder(org.springframework.core.codec.Decoder<?> decoder)
Override the default Kotlin Serialization JSON `Decoder`.

Parameters:
  `decoder` - the decoder instance to use
Since:
  5.3
See Also:
  - `KotlinSerializationJsonDecoder`

### kotlinSerializationJsonEncoder

void kotlinSerializationJsonEncoder(org.springframework.core.codec.Encoder<?> encoder)
Override the default Kotlin Serialization JSON `Encoder`.

Parameters:
  `encoder` - the encoder instance to use
Since:
  5.3
See Also:
  - `KotlinSerializationJsonEncoder`

### kotlinSerializationProtobufDecoder

void kotlinSerializationProtobufDecoder(org.springframework.core.codec.Decoder<?> decoder)
Override the default Kotlin Serialization Protobuf `Decoder`.

Parameters:
  `decoder` - the decoder instance to use
Since:
  6.0
See Also:
  - `KotlinSerializationProtobufDecoder`

### kotlinSerializationProtobufEncoder

void kotlinSerializationProtobufEncoder(org.springframework.core.codec.Encoder<?> encoder)
Override the default Kotlin Serialization Protobuf `Encoder`.

Parameters:
  `encoder` - the encoder instance to use
Since:
  6.0
See Also:
  - `KotlinSerializationProtobufEncoder`

### configureDefaultCodec

void configureDefaultCodec(Consumer<Object> codecConsumer)
Register a consumer to apply to default config instances. This can be used to configure rather than replace a specific codec or multiple codecs. The consumer is applied to every default `Encoder`, `Decoder`, `HttpMessageReader` and `HttpMessageWriter` instance.

Parameters:
  `codecConsumer` - the consumer to apply
Since:
  5.3.4

### maxInMemorySize

void maxInMemorySize(int byteCount)
Configure a limit on the number of bytes that can be buffered whenever the input stream needs to be aggregated. This can be a result of decoding to a single `DataBuffer`, `ByteBuffer`, `byte[]`, `Resource`, `String`, etc. It can also occur when splitting the input stream, for example, delimited text, in which case the limit applies to data buffered between delimiters.

By default this is not set, in which case individual codec defaults apply. All codecs are limited to 256K by default.

Parameters:
  `byteCount` - the max number of bytes to buffer, or -1 for unlimited
Since:
  5.1.11

### enableLoggingRequestDetails

void enableLoggingRequestDetails(boolean enable)
Whether to log form data at DEBUG level, and headers at TRACE level. Both may contain sensitive information.

By default set to `false` so that request details are not shown.

Parameters:
  `enable` - whether to enable or not
Since:
  5.1

### multipartCodecs

CodecConfigurer.MultipartCodecs multipartCodecs()
Configure encoders or writers for use with `MultipartHttpMessageWriter`.

Since:
  6.0.3

### multipartReader

void multipartReader(HttpMessageReader<?> reader)
Configure the `HttpMessageReader` to use for multipart requests.

Note that `maxInMemorySize(int)` and/or `enableLoggingRequestDetails(boolean)`, if configured, will be applied to the given reader, if applicable.

Parameters:
  `reader` - the message reader to use for multipart requests.
Since:
  6.0.3