博客
关于我
系统整理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主从失败 错误Got fatal error 1236解决方法
    查看>>
    MySQL主从架构与读写分离实战
    查看>>
    MySQL主从篇:死磕主从复制中数据同步原理与优化
    查看>>
    mysql主从配置
    查看>>
    MySQL之2003-Can‘t connect to MySQL server on ‘localhost‘(10038)的解决办法
    查看>>
    MySQL之CRUD
    查看>>
    MySQL之DML
    查看>>
    Mysql之IN 和 Exists 用法
    查看>>
    MYSQL之REPLACE INTO和INSERT … ON DUPLICATE KEY UPDATE用法
    查看>>
    MySQL之SQL语句优化步骤
    查看>>
    MYSQL之union和order by分析([Err] 1221 - Incorrect usage of UNION and ORDER BY)
    查看>>
    Mysql之主从复制
    查看>>
    MySQL之函数
    查看>>