标签:map 开发 framework val artifact ble web -o over
认识Fegin
Feign是简化Java HTTP客户端开发的工具(java-to-httpclient-binder),它的灵感
来自于Retrofit、JAXRS-2.0和WebSocket。Feign的初衷是降低统一绑定Denominator到
HTTP API的复杂度,不区分是否为restful。
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
@SpringBootApplication @EnableEurekaClient //eureka @EnableDiscoveryClient // @EnableFeignClients //相互调用 public class QaApplication { public static void main(String[] args) { SpringApplication.run(QaApplication.class, args); } }
//调用其他模块 @RequestMapping(value = "/label/{labelid}",method = RequestMethod.GET) public Result findLableById(@PathVariable String labelid) { Result result = labelClient.findById(labelid); return result; }
@FeignClient("tensquare-base")//服务名
public interface LabelClient {
@RequestMapping(value = "/label/{id}", method = RequestMethod.GET)
public Result findById(@PathVariable(value="id") String id) ;
}
标签:map 开发 framework val artifact ble web -o over
原文地址:https://www.cnblogs.com/liushisaonian/p/11259511.html