mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-03 15:59:31 +00:00
Update Kotlin Serialization configuration in HttpMessageConverters
As of As of spring-projects/spring-framework#35733, Spring Framework has a dedicated method for configuring a Kotlin Serialization converter specifically. This commit uses this method instead of configuring the Kotlin Serialization JSON support as a custom converter. This also removes the `@Order` on the Kotlin converter bean itself, as there is no need to order it in the list of custom converters anymore. Closes gh-47917
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ class DefaultClientHttpMessageConvertersCustomizer implements ClientHttpMessageC
|
||||
builder.withStringConverter(converter);
|
||||
}
|
||||
else if (converter instanceof KotlinSerializationJsonHttpMessageConverter) {
|
||||
builder.addCustomConverter(converter);
|
||||
builder.withKotlinSerializationJsonConverter(converter);
|
||||
}
|
||||
else if (converter.getSupportedMediaTypes().contains(MediaType.APPLICATION_JSON)) {
|
||||
builder.withJsonConverter(converter);
|
||||
|
||||
-2
@@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.http.converter.json.KotlinSerializationJsonHttpMessageConverter;
|
||||
|
||||
/**
|
||||
@@ -40,7 +39,6 @@ class KotlinSerializationHttpMessageConvertersConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@Order(-10) // configured ahead of JSON mappers
|
||||
KotlinSerializationJsonHttpMessageConverter kotlinSerializationJsonHttpMessageConverter(Json json) {
|
||||
return new KotlinSerializationJsonHttpMessageConverter(json);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user