在MVC配置文件中配置
<mvc:annotation-driven>
<!-- 解决@ResponseBody返回中文乱码 -->
<mvc:message-converters register-defaults="true">
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes" value="text/html;charset=UTF-8" />
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
时间: 2024-10-08 20:04:27