SpringBoot项目
zhouzhou377
这个作者很懒,什么都没留下…
展开
-
记录RestTemplate用法
不废话直接写代码RestTemplate 模版来发送请求exchange 发送GET请求postForObject 发送Post请求// 伪代码 发送接口请求//构建RestTemplate 模版对象RestTemplate restTemplate = new RestTemplate();//设定请求接口地址String url = "";//构建Map对象封装请求参数Map<String,Object> requestList = new HashMap<>原创 2021-04-06 17:10:30 · 93 阅读 · 0 评论 -
记录Springboot发起http post请求接收JSON实现
记录下springboot 接收接口实现。用到的基本都是APACHE原来用的 HttpClient 发起的post请求,在SpringBoot中已经算是比较老的方式,比较繁琐,需要构建多个http相关类型来相互调用。现在SpringBoot中Spring 推荐 RestTemplate来发起post请求。String url=url;//调用的接口地址String name = Student.getName().toString;String sex = Student.getSex().toS原创 2021-04-02 16:13:53 · 1727 阅读 · 0 评论