-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retryable doesn't work for inherited class methods #267
Comments
That other issue you commented on was about a different type of What version are you using? Some problems like this were fixed long ago; I just tested it with the latest version (1.3.1) and it works fine for me; @SpringBootApplication
@EnableRetry
public class Retgh267Application {
public static void main(String[] args) {
SpringApplication.run(Retgh267Application.class, args);
}
@Bean
ApplicationRunner runner(Bar bar) {
return args -> {
bar.canRetry();
};
}
}
class Foo {
@Retryable
void canRetry() {
System.out.println("here");
throw new RuntimeException("test");
}
}
@Repository
class Bar extends Foo {
}
|
Hi Gary, I figured out what was happening; So the issue I faced was not inheritance in the end, but local function redirections; @Repository
public class something() extends something2 {
public result mypubliclyexposedmethod(){
return myMethod()
}
}
public abstract class something2 {
@Retryable
public result myMethod(){
// some logic that can fail
}
} And so, in this case, the "local" function call redirection to the same object by-pass the proxy object and so the retry are not seen and acted on. (From what I could get! I may be wrong) |
Yes; local calls bypass the proxy; advised methods must be called from another bean. |
Closing as resolved; please reopen if you feel you need something more. |
Hi all,
So I've been trying to implement a Retryable annotation on a public method of a Bean that is inherited from another class.
When I put the annotation on the child class (on which the annotation for repository is) and use it on a method there, I'm able to make it work, but not if I put the Retryable at the parent level, it goes undetected.
i.e.
Not sure if this is a valid usecase though. Please let me know what you think.
The text was updated successfully, but these errors were encountered: