@FeignClient的使用

  , ,
评论 • 12 浏览

    一、maven引入依赖

    <dependency>
         <groupId>org.springframework.cloud</groupId>
         <artifactId>spring-cloud-starter-openfeign</artifactId>
    </dependency>
    

    二、xxxApp.java添加@EnableFeignClients
    三、新建一个client的接口类

    @FeignClient(name = "voiceServer",url = "${application.voiceServer}")
    public interface VoiceClient {
      @PostMapping("/api/transfer-tasks")
      ResponseEntity saveTransferTasks(@RequestBody TransferTasksDTO transferTasksDTO);
    
    版权声明:本文为博主原创文章,欢迎大家转载,但需保留文章链接。个人博客地址:http://www.wenboblogs.cn
    评论
    validate