Skip to content

Commit 2e52c3c

Browse files
committed
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
1 parent fc66e12 commit 2e52c3c

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

module/spring-boot-http-converter/src/main/java/org/springframework/boot/http/converter/autoconfigure/DefaultClientHttpMessageConvertersCustomizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void customize(ClientBuilder builder) {
5252
builder.withStringConverter(converter);
5353
}
5454
else if (converter instanceof KotlinSerializationJsonHttpMessageConverter) {
55-
builder.addCustomConverter(converter);
55+
builder.withKotlinSerializationJsonConverter(converter);
5656
}
5757
else if (converter.getSupportedMediaTypes().contains(MediaType.APPLICATION_JSON)) {
5858
builder.withJsonConverter(converter);

module/spring-boot-http-converter/src/main/java/org/springframework/boot/http/converter/autoconfigure/KotlinSerializationHttpMessageConvertersConfiguration.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
2525
import org.springframework.context.annotation.Bean;
2626
import org.springframework.context.annotation.Configuration;
27-
import org.springframework.core.annotation.Order;
2827
import org.springframework.http.converter.json.KotlinSerializationJsonHttpMessageConverter;
2928

3029
/**
@@ -40,7 +39,6 @@ class KotlinSerializationHttpMessageConvertersConfiguration {
4039

4140
@Bean
4241
@ConditionalOnMissingBean
43-
@Order(-10) // configured ahead of JSON mappers
4442
KotlinSerializationJsonHttpMessageConverter kotlinSerializationJsonHttpMessageConverter(Json json) {
4543
return new KotlinSerializationJsonHttpMessageConverter(json);
4644
}

0 commit comments

Comments
 (0)