springMVC返回json
<mvc:annotation-driven>
        <mvc:message-converters register-defaults="true">
            <!-- 将StringHttpMessageConverter的默认编码设为UTF-8 -->
            <bean class="org.springframework.http.converter.StringHttpMessageConverter">
                <constructor-arg value="UTF-8" />
            </bean>
            <!-- Spring默认Json转换器 -->
            <bean
                class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
                <property name="prettyPrint" value="true" />
            </bean>
          
        </mvc:message-converters>
    </mvc:annotation-driven>

 

posted on 2016-09-12 10:53  james-roger  阅读(124)  评论(0编辑  收藏  举报