网关中增加全局过滤器

@Bean
public GlobalFilter c() {
    return (exchange, chain) -> {
        exchange.getRequest().mutate().header("traceId", UUID.randomUUID().toString()).build();
        return chain.filter(exchange);
    };
}

下游系统获取

@GetMapping("/test”)
public JSONObject search(@RequestHeader String traceId){
    log.info("traceId {}",traceId);
}

 

相关文章:

  • 2022-02-28
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
  • 2021-09-13
  • 2021-06-14
猜你喜欢
  • 2022-02-09
  • 2022-12-23
  • 2022-02-09
  • 2022-02-09
  • 2021-07-25
  • 2021-07-23
相关资源
相似解决方案