The documentation for configureMessageConverters
states:
Note use of this method turns off default converter registration. Alternatively, use extendMessageConverters(java.util.List) to modify that default list of converters.
This does not seem to be the case. My expectation from the documentation is that if I defined this override, my application will just use the converters I register manually there. However, if I inspect the list it contains the default converters. I can clear the list but the behaviour doesn't seem to match the documentation.
I have attached a simple application that shows the issue (test.zip).
Comment From: rstoyanchev
configureMessageConverters
works as documented if used on its own. However, in a Boot application, the WebMvcAutoConfiguration
adds message converters through its HttpMessageConverters
mechanism, which by default includes any HttpMessageConverter
beans, and default converters. So the way to customize this in a Boot application is through HttpMessageConverters, or use the extendMessageConverters
which lets you customize the resulting list at the end.
I'll update the Javadoc to at least mention this, but aside from that it's expected behavior.
For future reference, please provide a Maven or Gradle configured sample. You can use https://start.spring.io/.