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 Screenshot_20210122_135950

then an additional call is coming from requestMappingHandlerAdapter() method in WebMvcConfigurationSupport and this list then contains duplicates Screenshot_20210122_140201

here we see that we have two instances of StringHttpMessageConverter, when we inspect the details we see that they are configured differently Screenshot_20210122_140401

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 Screenshot_20210122_140704

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