记得上下班打卡 | git大法好,push需谨慎

Commit 0bdbbc49 authored by 张国柄's avatar 张国柄

fix:http

parent d45adfb0
package com.liquidnet.commons.lang.util;
import com.liquidnet.commons.lang.util.spring.SpringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
......@@ -11,6 +14,11 @@ import java.util.List;
import java.util.Map;
public class HttpUtil {
private static RestTemplate restTemplate;
static {
restTemplate = SpringUtils.getBean(RestTemplate.class);
}
/**
* get请求
......@@ -142,7 +150,7 @@ public class HttpUtil {
}
HttpEntity<Object> httpEntity = new HttpEntity(params, httpHeaders);
RestTemplate restTemplate = new RestTemplate();
// RestTemplate restTemplate = new RestTemplate();
// 提交方式:表单、json
ResponseEntity<String> response = restTemplate.exchange(url, method, httpEntity, String.class);
return response.getBody();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment