http请求
maven依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
application.yaml配置连接
userfoot.url: http://recsys.bigdata.api
Fegin连接
name:指定FeignClient的名称,name属性会作为微服务的名称,用于服务发现
url:url一般用于调试,可以手动指定@FeignClient调用的地址
path:定义当前FeignClient的统一前缀
FeignClient接口,不能使用@GettingMapping 之类的组合注解
FeignClient接口中,如果使用到@PathVariable ,必须指定其value
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(url = "${userfoot.url}", name = "member-view-his