Skip to content
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

Combining @Retryable and @Scheduled/@JmsListener doesn't work [SPR-16196] #20744

Closed
spring-projects-issues opened this issue Nov 14, 2017 · 9 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Nov 14, 2017

Selim Ok opened SPR-16196 and commented

Hi,

if I use @Retryable annotation for a method of a certain bean and @scheduled for another method of the same bean, ScheduledAnnotationBeanPostProcessor doesn't process this class and thus @Scheduled method is not executed. This is a very strange problem.

If I remove the @Retryable annotation, ScheduledAnnotationBeanPostProcessor process the bean with processScheduled() method and the scheduled task is executed without any problem.

I already created a ticket to spring-retry project on github (spring-projects/spring-retry#94). Mr. Russell can reproduce the problem with a slightly different symptom. He think that might be an issue with the ScheduledAnnotationBeanPostProcessor.

Thank you.
Selim


Affects: 4.3.10, 4.3.12

Reference URL: spring-projects/spring-retry#94

Issue Links:

Backported to: 4.3.14

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

It looks like ScheduledAnnotationBeanPostProcessor doesn't look through multiple layers of proxies there. I'm about to fix this for both 5.0.3 and 4.3.14.

@spring-projects-issues
Copy link
Collaborator Author

Selim Ok commented

Thanks :)

@spring-projects-issues
Copy link
Collaborator Author

Selim Ok commented

Hi Again,

I just discovered a similar problem with @JmsListener Annotation. If I combine it with another annotation (in this case was a custom Annotation of me @LogMethod) JmsListenerAnnotationBeanPostProcessor doesn't process @JmsListener annotations.

Should I open a separate Ticket? May all *AnnotationBeanPostProcessor's have the same problem?

Thanks.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Let's deal with it as part of this ticket still since we're fixing it for the same target versions anyway. I've applied the same change to JmsListenerAnnotationBeanPostProcessor which is indeed very analogous to ScheduledAnnotationBeanPostProcessor there.

@spring-projects-issues
Copy link
Collaborator Author

Selim Ok commented

Perfect :)

@spring-projects-issues
Copy link
Collaborator Author

Mauro Monti commented

Hi Juergen,

I believe that I hit the same issue when using cloud aws @SqsListener and @Retryable in the same service class, but in this case, I can't find a post-processor related to the SqsListener.
Can you point me where to look for this case? I can probably contribute with a PR if I can fix it.

Thanks!,

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Feb 3, 2018

Gary Russell commented

I am not familiar with the project, but @SqsListener is defined in spring-cloud-aws-messaging in spring-cloud-aws..

@spring-projects-issues
Copy link
Collaborator Author

Selim Ok commented

Hi There,

I experienced the same problem with Spring 4.3.15. 

I have @Service annotated class. It has a method say methodA annotated with @Retryable and another one say methodB annotated with @Scheduled

Immediately after I removed @Retryable annotation from this class, @Scheduled annotation is processed by ScheduledAnnotationBeanPostProcessor. Otherwise the methodB seems like as it has no annotation at all. 

The same behaviour repeated if I annotate any method in this class with @Cacheable . That's very strange.

Can you please re-open this ticket?

Thanks.

 

 

@spring-projects-issues
Copy link
Collaborator Author

Selim Ok commented

Oh I'm sorry, this is my fault. Please ignore my last comment. Due to a maven dependency conflict my project used effectively spring-context 4.3.13 . 

Sorry  again. 

@spring-projects-issues spring-projects-issues added type: bug A general bug status: backported An issue that has been backported to maintenance branches in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.0.3 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants