zoukankan      html  css  js  c++  java
  • 关于feign调用的时候,动态传url ,以及自定义head

     1 package com.fdd.op.autoconfigure.http.client.service;
     2 
     3 import com.alibaba.fastjson.JSONObject;
     4 import com.fdd.op.autoconfigure.http.feign.FeignHttpClientConfiguration;
     5 import org.springframework.cloud.openfeign.FeignClient;
     6 import org.springframework.web.bind.annotation.PostMapping;
     7 import org.springframework.web.bind.annotation.RequestBody;
     8 import org.springframework.web.bind.annotation.RequestHeader;
     9 
    10 import java.net.URI;
    11 
    12 
    13 /**
    14  * API 回调  feign
    15  * url = "EMPTY"  随便填都行,会被下方的参数URI 覆盖
    16  *
    17  * @author kuangql
    18  */
    19 @FeignClient(name = "apiServiceClient", url = "EMPTY", configuration = FeignHttpClientConfiguration.class)
    20 public interface ApiServiceClient {
    21 
    22 
    23     /**
    24      * api 回调
    25      *
    26      * @param url         动态地址
    27      * @param jsonObject  json 回调值
    28      * @param opAppId     head
    29      * @param opNonce     head
    30      * @param opTimestamp head
    31      * @param opSignType  head
    32      * @param opVersion   head
    33      * @param opSign      head
    34      * @return result
    35      */
    36     @PostMapping(headers = {"Content-Type: application/json"})
    37     String sendApiNotify(URI url, @RequestBody JSONObject jsonObject,
    38                          @RequestHeader("opAppId") String opAppId, @RequestHeader("opNonce") String opNonce,
    39                          @RequestHeader("opTimestamp") String opTimestamp, @RequestHeader("opSignType") String opSignType,
    40                          @RequestHeader("opVersion") String opVersion, @RequestHeader("opSign") String opSign
    41     );
    42 
    43 }

     测试过很多注解传header,但是会翻车。

     需要设置超时,重试次数,参考。

    https://blog.csdn.net/kysmkj/article/details/89672952

  • 相关阅读:
    Python格式符号
    Python基础知识
    HDFS 数据流程
    HDFS IO流操作
    HDFS API操作
    Hadoop 客户端环境准备
    Hadop 环境搭建 windows10+hadoop2.7.7
    Hadoop HDFS shell
    Hadoop HDFS 基础
    centos 更改清华源
  • 原文地址:https://www.cnblogs.com/woshuaile/p/15264521.html
Copyright © 2011-2022 走看看