[SpringMVC] - 解决Jackson中文乱码 : springmvc-servlet.xml

<!-- 指定响应体返回类型和编码 , 解决乱码????的问题 -->
    <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>

 

上一篇:Long 类型格式化成String 传给前端


下一篇:记录Jackson2.2.9将对象转换json数据问题