第一种方式
<mvc:annotation-driven>
<!-- 消息转换器,解决responseBody返回中外乱码问题 -->
<mvc:message-converters register-defaults="true">
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes" value="text/plainn;charset=UTF-8" />
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
第二种
@RequestMapping(value = "/test",produces = {"text/plain;charset=UTF-8"})