1.引入依赖
<!-- eureka-client -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<!--openfeign-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
2.开启支持
@EnableFeignClients
3.编写接口
@FeignClient(value = "服务名")
public interface GoodsFeign {
@GetMapping("goods/findOne/{id}")
public Goods findGoodsById(@PathVariable("id")int id);
}