使用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.调用接口发送数据