博客
关于我
系统整理springCloud系列(六)openfeign
阅读量:192 次
发布时间:2019-02-28

本文共 1325 字,大约阅读时间需要 4 分钟。

OpenFeign?????????

??????

??????OpenFeign????????????Feign????????????Maven????

org.springframework.cloud
spring-cloud-starter-openfeign

????????

?????????@SpringBootApplication?@EnableFeignClients??????OpenFeign??????????????

@SpringBootApplication@EnableEurekaClient@EnableFeignClientspublic class OrderFeignMain80 {    public static void main(String[] args) {        SpringApplication.run(OrderFeignMain80.class, args);    }}

??????

??Feign???????????????????????

@Component@FeignClient(value = "CLOUD-PAYMENT-SERVICE")public interface PaymentFeignService {    @GetMapping(value = "/payment/get/{id}")    public CommonResult getPaymentById(@PathVariable("id") Long id);}

??????

OpenFeign????Ribbon???????????????????????

  • ReadTimeout: 6000ms????????????
  • ConnectTimeout: 6000ms??????????

?????????

?????????????????????????????????????????

try {    Thread.sleep(10000L);} catch (InterruptedException e) {    e.printStackTrace();}

??????

?????????Feign????????????????????

@Configurationpublic class FeignConfig {    @Bean    public Logger.Level feignLoggerLevel() {        return Logger.Level.FULL;    }}

?????????

???????????????????????????

  • ???????????????????????????
  • Ribbon???????Ribbon?????????????
  • OpenFeign???????????????????????
  • ????????????????Feign??????????????????????????

    转载地址:http://jlon.baihongyu.com/

    你可能感兴趣的文章
    MySQL数据库 范式
    查看>>
    Mysql数据库B-Tree索引
    查看>>
    mysql数据库io空闲_mysql数据库磁盘io高的排查
    查看>>
    mysql数据库root密码忘记,查看或修改的解决方法
    查看>>
    MySQL数据库SQL注入靶场sqli通关实战(附靶场安装包)
    查看>>
    MYSQL数据库下载安装(Windows版本)
    查看>>
    MySQL数据库与Informix:能否创建同名表?
    查看>>
    mysql数据库中的数据如何加密呢?mysql8.0自带新特性
    查看>>