关于Spring的重试(Regarding Retry with Spring)

编程入门 行业动态 更新时间:2024-10-27 11:27:26
关于Spring的重试(Regarding Retry with Spring)

我在我的应用程序中调用了一个Web服务,它具有可以过期的身份验证令牌。 如果令牌过期,我需要刷新令牌并重试Web服务。 要做到这一点,我觉得春天重试可能是正确的候选人。 但我不知道如何在我的重试之间注入此刷新令牌服务。

I am calling a webservice in my Application which has authentication tokens that can expire. In case of token expiry, I need to refresh the token and retry the webservice. To do this, I felt spring retry might be the right candidate. But I have no idea how to inject this refresh token service in between my retries.

最满意答案

Spring Retry不是你想要的。 这就是幂等操作,你只需再试一次。

这是OAuth令牌吗? 然后你想要Spring Security OAuth 。

即使不是你想做Oauth2RestTemplate所做的事情:将令牌处理挂钩到客户端。

Spring Retry is not what you want. That is for idempotent operations where you literally just try again.

Is this an OAuth token? Then you want Spring Security OAuth.

Even if not you want to do the same thing that Oauth2RestTemplate does: hook the token handling into the client.

更多推荐

本文发布于:2023-07-30 07:22:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336693.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重试   Spring   Retry

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!