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 status: backported type: bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues 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:

  • #21100 @JmsListener annotated method need to be extracted to interface even if CGLIB used

Backported to: 4.3.14

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jan 12, 2018

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

@spring-projects-issues spring-projects-issues commented Jan 16, 2018

Selim Ok commented

Thanks :)

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jan 16, 2018

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

@spring-projects-issues spring-projects-issues commented Jan 16, 2018

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

@spring-projects-issues spring-projects-issues commented Jan 16, 2018

Selim Ok commented

Perfect :)

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Feb 3, 2018

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 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

@spring-projects-issues spring-projects-issues commented Aug 29, 2018

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

@spring-projects-issues spring-projects-issues commented Aug 29, 2018

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. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: backported type: bug
Projects
None yet
Development

No branches or pull requests

2 participants