Java使用FeignClient发送HTTP 请求


使用FeignClient发送HTTP请求
1.添加依赖
<!-- spring cloud jar-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>

2.发送接口
@FeignClient(name = "**ServiceClient", url = "${url.signerUrl}" )
public interface **ServiceClient {

@RequestMapping(value = "/***", method = RequestMethod.POST)
public String ***(@RequestBody(required = true) String param);

}

3.调用接口发送数据


posted @ 2019-08-25 22:28  Fernando_Y  阅读(5509)  评论(0编辑  收藏  举报