<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><!-- 将Jackson2HttpMessageConverter的默认格式化输出设为true --><bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"><property name="prettyPrint" value="true"/><property name="supportedMediaTypes"><list><value>text/html;charset=UTF-8</value><value>application/json;charset=UTF-8</value></list></property></bean> </mvc:message-converters></mvc:annotation-driven>
db.driver=com.mysql.jdbc.Driverdb.url=jdbc:mysql://localhost:3306/test?useSSL=false&useUnicode=true&characterEncoding=UTF-8db.username=rootdb.password=123456
如果觉得《SpringMVC中向服务器传输数据(解决get post delete put请求乱码问题)》对你有帮助,请点赞、收藏,并留下你的观点哦!