Skip to content

Commit

Permalink
Added code snippet for SourceHttpMessageConverter configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Ramón Román Nissen <rromannissen@gmail.com>
  • Loading branch information
rromannissen authored Nov 22, 2024
1 parent 52fb1c2 commit e69af92
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<HttpMessageConverter<?>> 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:
Expand Down

0 comments on commit e69af92

Please sign in to comment.