为所有Integrationflows中的每个.handle()方法全局注册建议。

huangapple go评论79阅读模式
英文:

Register advice globally for each .handle() method in all Integrationflows

问题

有没有一种方法可以这样做:

.handle(Http.outboundGateway(host + url)
        .httpMethod(HttpMethod.POST)
        .mappedRequestHeaders("contentType", "x-api-key")
        .expectedResponseType(String.class), e -> e.advice(expressionEvaluatingRequestHandlerAdvice))

其中这个 advice 是在全局某个地方注册的,这样你就不需要在每次调用中都注册它了。

项目中有很多 HTTP 出站网关需要应用/注册相同的 advice,想知道是否必须为每一个手动进行注册。

英文:

Is there a way to do this:

                            .handle(Http.outboundGateway(host + url)
                                    .httpMethod(HttpMethod.POST)
                                    .mappedRequestHeaders("contentType", "x-api-key")
                                    .expectedResponseType(String.class), e -> e.advice(expressionEvaluatingRequestHandlerAdvice))

where the advice is registered globally somewhere so you don't have to register it in each call?

There are a lot of http outbound gateways in the project to which I need to apply/register the same advice and was wondering if I have to do it manually for each of them.

答案1

得分: 1

目前没有一个可以(有条件地)应用于多个端点的“全局”建议的概念。

欢迎在GitHub上提出新的功能建议,欢迎贡献。

英文:

No; there is currently no concept of a "global" advice that can be (conditionally) applied to multiple endpoints.

Feel free to open a new feature suggestion on GitHub and contributions are welcome.

huangapple
  • 本文由 发表于 2020年8月17日 05:12:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/63441987.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定