方式一:修改Spring配置文件(建议使用)

<mvc:annotation-driven>
    <mvc:message-converters register-defaults="true">
        <bean class="org.springframework.http.converter.StringHttpMessageConverter">
            <constructor-arg value="UTF-8"/>
        </bean>
        <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
            <property name="objectMapper">
                <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean">
                    <property name="failOnEmptyBeans" value="false"/>
                </bean>
            </property>
        </bean>
    </mvc:message-converters>
</mvc:annotation-driven>
View Code

相关文章:

  • 2021-09-29
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2021-11-30
  • 2021-09-12
  • 2022-01-05
猜你喜欢
  • 2021-04-11
  • 2021-12-05
  • 2022-02-06
  • 2021-10-11
  • 2021-11-30
  • 2022-12-23
相关资源
相似解决方案