我在我的应用程序中调用了一个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.
更多推荐
发布评论