we had a serious issue with some custom HttpMessageConverters so we debugged a little bit the code and had one observation that doesn't look correct. This behaviour is also present when a plain spring boot application is created by using https://start.spring.io/ and only selecting "Spring Web" dependency. (choosing Maven, Java, SpringBoot 2.4.2 and Java 15)
The thing is that when we had a breakpoint in WebMvcConfigurationSupport
in method getMessageConverters()
at the return statement, we have seen that this list contains some duplicates which are also configured differently.
The first call we have seen was initiated by the HttpMessageConverters
constructor -> this list does not contain any duplicate
then an additional call is coming from requestMappingHandlerAdapter()
method in WebMvcConfigurationSupport
and this list then contains duplicates
here we see that we have two instances of StringHttpMessageConverter
, when we inspect the details we see that they are configured differently
the suspicious part here is probably the HttpMessageConverters
constructor which gets these two duplicates as an argument and then combine these with the default converters
Comment From: bclozel
Could you take a look at #21374 first (and linked issues) and report back?
We're always interested in optimizing things but I'm not sure we can do that here.
Comment From: BigMichi1
yes it's a duplicate of #21374, sry