企业级开发中一般使用feign而不用ribbon,不过feign也是基于ribbon开发的,支持注解。
1、application添加注解开启feign
2、创建接口client
package cn.bestriven.www.client;
import cn.bestriven.www.client.vo.AdPlan;
import cn.bestriven.www.client.vo.AdPlanGetRequest;
import cn.bestriven.www.vo.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List;
/**
* @Author: liufan
* @Date: 2019/8/20 13:43
* @Description:
*/
@FeignClient(value = "eureka-client