1.如果用springboot框架就用被我注释的那个,如果不是就用没注释的。
<!--web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.4.RELEASE</version>
<scope>compile</scope>
</dependency>
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>-->
RestTemplate restTemplate = new RestTemplate();
//发送的地址,json格式
JSONObject obj =restTemplate.postForObject("http://commerce.5166.info/api/case/updateTestResult", json, JSONObject.class);