Skip to content

服务间如何进行伪RPC调用

halower edited this page Mar 2, 2018 · 1 revision
  1. 在服务pom.xml中添加如下依赖
   <dependency>
       <groupId>org.springframework.cloud</groupId>
       <artifactId>spring-cloud-starter-feign</artifactId>
       <version>1.3.0.RELEASE</version>
   </dependency>
  1. 使用方式(定义接口后使用依赖注入的方式在使用类中调用)
@FeignClient(name = "服务名")
public interface TestFeignClient {
    @GetMapping("/demo/{id}")
    public Demo findDemo(@PathVariable("id") int id);
}
Clone this wiki locally