I would like to change my spring app default "Content-type" to "application/json;charset=utf-8" instead of only "application/json"
Spring > 4.3.4
@RequestMapping(produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Configuration
@EnableWebMvc
public class MVCConfig extends WebMvcConfigurerAdapter {
@Override
public void configureContentNegotiation(
ContentNegotiationConfigurer configurer) {
final Map<String, String> parameterMap = new HashMap<String, String>();
parameterMap.put("charset", "utf-8");
configurer.defaultContentType(new MediaType(
MediaType.APPLICATION_JSON, parameterMap));
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With