1. @Bean
    2. public HttpMessageConverter<String> responseBodyConverter() {
    3. StringHttpMessageConverter converter = new StringHttpMessageConverter(
    4. Charset.forName("UTF-8"));
    5. return converter;
    6. }
    7. @Override
    8. public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    9. super.configureMessageConverters(converters);
    10. converters.add(responseBodyConverter());
    11. }
    12. @Override
    13. public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    14. configurer.favorPathExtension(false);
    15. }

    原文地址:https://blog.csdn.net/jfqqqqq/article/details/124005319