The problem you see is related to the way you call your getInfo() method.
In the first example, you call getInfo() from the same spring managed bean. In the second example, you call getInfo() from another spring managed bean. This difference is subtle, but very important, and very likely what causes your problems.
When you use the @Retryable annotation, spring creates a proxy server around your original bean so that they can perform special processing in special circumstances. In this particular case, spring applies a tip that delegates the call to your actual method, catches a RuntimeException that it can throw, and retry calling your method according to the configuration of the @Retryable annotation.
The reason this proxy matters in your case is because only external callers see the proxy advice. Your bean does not know that it is proxied, and only knows that its methods are called (according to the proxy). When your bean calls the method on its own, no additional proxying occurs, so retrying is not performed.
source share