spring cloud学习笔记 Feign支持接口继承方式快速生成客户端

源码地址:https://gitee.com/nnsword/wy2-cloud/tree/master

//用户资源接口
public interface UserService {

    @RequestMapping(method = RequestMethod.GET, value ="/users/{id}")
    User getUser(@PathVariable("id") long id);
}

//用户资源接口实现
@RestController
public class UserResource implements UserService {

}


//用户资源Feign客户端
@FeignClient("users")
public interface UserClient extends UserService {

}

你可能感兴趣的:(SpringCloud,springboot)