From 58844dde6c35918b5c6c0c9e4637f976b8a9f453 Mon Sep 17 00:00:00 2001 From: Felix Haller Date: Thu, 11 Nov 2021 13:48:17 +0100 Subject: [PATCH] use default message converters. only override jackson msg converter --- .../check/ws/VerificationCheckWS.java | 2 -- .../check/ws/config/WsBaseConfig.java | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ch-covidcertificate-backend-verification-check/ch-covidcertificate-backend-verification-check-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verification/check/ws/VerificationCheckWS.java b/ch-covidcertificate-backend-verification-check/ch-covidcertificate-backend-verification-check-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verification/check/ws/VerificationCheckWS.java index dbad3f3..c4e645a 100644 --- a/ch-covidcertificate-backend-verification-check/ch-covidcertificate-backend-verification-check-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verification/check/ws/VerificationCheckWS.java +++ b/ch-covidcertificate-backend-verification-check/ch-covidcertificate-backend-verification-check-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verification/check/ws/VerificationCheckWS.java @@ -14,7 +14,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; @Configuration @ComponentScan( @@ -24,7 +23,6 @@ "ch.admin.bag.covidcertificate.rest" }) @EnableAutoConfiguration -@EnableWebMvc public class VerificationCheckWS { public static void main(String[] args) { diff --git a/ch-covidcertificate-backend-verification-check/ch-covidcertificate-backend-verification-check-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verification/check/ws/config/WsBaseConfig.java b/ch-covidcertificate-backend-verification-check/ch-covidcertificate-backend-verification-check-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verification/check/ws/config/WsBaseConfig.java index fbc913e..66849c9 100644 --- a/ch-covidcertificate-backend-verification-check/ch-covidcertificate-backend-verification-check-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verification/check/ws/config/WsBaseConfig.java +++ b/ch-covidcertificate-backend-verification-check/ch-covidcertificate-backend-verification-check-ws/src/main/java/ch/admin/bag/covidcertificate/backend/verification/check/ws/config/WsBaseConfig.java @@ -18,21 +18,23 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.module.kotlin.KotlinModule; import java.time.Instant; -import java.util.List; +import java.util.Collections; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.client.RestTemplate; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration -public abstract class WsBaseConfig implements WebMvcConfigurer { +public abstract class WsBaseConfig { - @Override - public void configureMessageConverters(final List> converters) { - converters.add(new MappingJackson2HttpMessageConverter(objectMapper())); - WebMvcConfigurer.super.configureMessageConverters(converters); + @Bean + public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() { + MappingJackson2HttpMessageConverter jacksonConverter = + new MappingJackson2HttpMessageConverter(objectMapper()); + jacksonConverter.setSupportedMediaTypes( + Collections.singletonList(MediaType.APPLICATION_JSON)); + return jacksonConverter; } @Bean