From e69af927d5af8a4773985c29e1d722473691c5cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Rom=C3=A1n=20Nissen?= Date: Fri, 22 Nov 2024 17:26:32 +0100 Subject: [PATCH] Added code snippet for SourceHttpMessageConverter configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ramón Román Nissen --- ...-framework-5.x-to-6.0-web-applications.yaml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/default/generated/spring-framework/spring-framework-5.x-to-6.0-web-applications.yaml b/default/generated/spring-framework/spring-framework-5.x-to-6.0-web-applications.yaml index 00152c5b..0c633eaa 100644 --- a/default/generated/spring-framework/spring-framework-5.x-to-6.0-web-applications.yaml +++ b/default/generated/spring-framework/spring-framework-5.x-to-6.0-web-applications.yaml @@ -72,7 +72,23 @@ message: | `SourceHttpMessageConverter` is not configured by default anymore in Spring MVC and `RestTemplate`. As a consequence, Spring web applications using `javax.xml.transform.Source` now need to configure - `SourceHttpMessageConverter` explicitly. Note that the order of converter registration is important, + `SourceHttpMessageConverter` explicitly. + + ```java + @EnableWebMvc + @Configuration + @ComponentScan({ "org.konveyor.web" }) + public class WebConfig implements WebMvcConfigurer { + + @Override + public void configureMessageConverters(List> messageConverters) { + messageConverters.add(new SourceHttpMessageConverter()); + messageConverters.add(new MappingJackson2HttpMessageConverter()); + } + } + ``` + + Note that the order of converter registration is important, and `SourceHttpMessageConverter` should typically be registered before "catch-all" converters like `MappingJackson2HttpMessageConverter` for example. links: