1. java对象转json;
JSONObject jsonObject=JSONObject.fromObject(userDto);
pom.xml配置
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
2. 解决乱码问题,只需要在调用的地方前面加一句;
oAuth2RestTemplate.getMessageConverters