Version: Spring Framework 5.2.7
MappingJackson2HttpMessageConverter
* <p>By default, this converter supports {@code application/json} and {@code application/*+json}
* with {@code UTF-8} character set. This can be overridden by setting the
* {@link #setSupportedMediaTypes supportedMediaTypes} property.
The above comment says that MappingJackson2HttpMessageConverter's default charater set is UTF-8.
But my MappingJackson2HttpMessageConverter's default characterSet is null.
Is the comment wrong? Or am I doing somethig wrong?
Is the default character set deprecated?
If the default character set is deprecated, I think it would be better to delete the content from the comment.
Comment From: bclozel
I'm not sure I understand the issue. JSON encoding is UTF-8 by default (see #22788).
This defaultCharset
attribute is inherited from its class hierarchy - being null
might be perfectly acceptable since it's marked as @Nullable
.
Do you have a sample application that shows an incorrect behavior? If so, could you share it with us?
Comment From: kyucumber
@bclozel
I saw the document (#22788) Thank you.
It works well in spring applications. However, some tests using mockMvc do not work normally.
The defaultCharacterSet is UTF-8 in the comment of the MappingJackson2HttpMessageConverter class. However, the defaultCaracterSet value of the parent class value was null. So I was confused.
I'll close because I'm sure there's no problem with that content. Thank you.