最近在用ECharts+echarts java搞数据统计。
先建了独立项目测试没问题,然后转移到工作项目内,却出现乱码,所有中文都为???
对比发现前后台都为UTF-8编码,后台数据也正常,为啥到前台就乱码了?
对比发现spring mvc配置文件没有
<bean
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<bean
class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/plain;charset=UTF-8</value>
</list>
</property>
</bean>
<bean
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</list>
</property>
</bean>
赶快加上果然解决。。