Class AbstractKotlinSerializationHttpMessageConverter<T extends kotlinx.serialization.SerialFormat>

Type Parameters:
T - the type of SerialFormat
All Implemented Interfaces:
HttpMessageConverter<Object>, SmartHttpMessageConverter<Object>
Direct Known Subclasses:
KotlinSerializationBinaryHttpMessageConverter, KotlinSerializationStringHttpMessageConverter

public abstract class AbstractKotlinSerializationHttpMessageConverter<T extends kotlinx.serialization.SerialFormat> extends AbstractSmartHttpMessageConverter<Object>
Abstract base class for HttpMessageConverter implementations that use Kotlin serialization.

As of Spring Framework 7.0, by default it only encodes types annotated with @Serializable at type or generics level since it allows combined usage with other general purpose converters without conflicts. Alternative constructors with a Predicate<ResolvableType> parameter can be used to customize this behavior.

Since:
6.0
Author:
Andreas Ahlenstorf, Sebastien Deleuze, Juergen Hoeller, Iain Henderson, Arjen Poutsma
  • Constructor Details

    • AbstractKotlinSerializationHttpMessageConverter

      protected AbstractKotlinSerializationHttpMessageConverter(T format, MediaType... supportedMediaTypes)
      Creates a new instance with the given format and supported mime types which only converters types annotated with @Serializable at type or generics level.
    • AbstractKotlinSerializationHttpMessageConverter

      protected AbstractKotlinSerializationHttpMessageConverter(T format, Predicate<org.springframework.core.ResolvableType> typePredicate, MediaType... supportedMediaTypes)
      Creates a new instance with the given format and supported mime types which only converts types for which the specified predicate returns true.
      Since:
      7.0
  • Method Details