专栏目录
文章
第 03 章:OpenFeign 声明式调用
2026-07-23 04:09:00
  • 阅读: 0
  • OpenFeign 声明式调用

    一、定义接口

    java 复制代码
    @FeignClient(name = "user-service")
    public interface UserClient {
        @GetMapping("/users/{id}")
        User getById(@PathVariable Long id);
    }

    二、配置

    yaml 复制代码
    feign:
      client:
        config:
          default:
            connect-timeout: 5000
            read-timeout: 10000