依赖包:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
<version>1.2.2.RELEASE</version>
</dependency>
除了以上,还得在Application配置可用包路径
@EnableFeignClients("com.gy.api")
如调用百度的一个api
@FeignClient(url = "${baidumap.url}",name="bmurl")
public interface BaiduApi {
@RequestMapping(value="/routematrix/v2/driving",method= RequestMethod.GET)
public String getdis(@RequestParam("ak") String ak,
@RequestParam("output") String json,
@RequestParam("origins") String origins,
@RequestParam("destinations") String destinations
);
}