springboot项目中怎样将token添加到请求头中

public static String doGet(String url,String token) throws IOException {

    //指定请求路径及方式
    HttpGet httpGet = new HttpGet(url);
    //创建请求客户端
    HttpClient httpClient = new DefaultHttpClient();
    //执行请求,并得到返回结果
    HttpResponse httpResponse = httpClient.execute(httpGet);

    return httpResponse;
}


URL url = new URL("你的请求地址");

HttpURLConnection conn = (HttpURLConnection) url.openConnection();

 conn.setRequestProperty("token",“你的token”);

httpGet.addHeader("token",token);