springboot成神之——RestTemplate访问Rest
2021-07-02 23:06
标签:.post pack string public run 方法 toc framework figure springboot成神之——RestTemplate访问Rest 标签:.post pack string public run 方法 toc framework figure 原文地址:https://www.cnblogs.com/ye-hcj/p/9627636.html本文介绍RestTemplate访问Rest
demo
package com.springlearn.learn;
import java.util.Arrays;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(new MediaType[]{MediaType.APPLICATION_JSON_UTF8}));
// Get
// HttpEntity
文章标题:springboot成神之——RestTemplate访问Rest
文章链接:http://soscw.com/essay/100999.html