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

@Retryable not actually retrying #148

Open
Ghilteras opened this issue Feb 23, 2019 · 5 comments
Open

@Retryable not actually retrying #148

Ghilteras opened this issue Feb 23, 2019 · 5 comments

Comments

@Ghilteras
Copy link

Ghilteras commented Feb 23, 2019

Since I have no @Configuration class in my project I tried creating an empty one just with @EnableRetry and @Configuration but it does not make my method use @Retryable so I have tried these two xml configurations instead

 <context:annotation-config />
    <aop:aspectj-autoproxy />
    <bean class="org.springframework.retry.annotation.RetryConfiguration" />

and

    <aop:config>
        <aop:pointcut id="transactional"
                      expression="execution(* com..*MyCLass.myMethod(..))" />
        <aop:advisor pointcut-ref="transactional"
                     advice-ref="retryAdvice" order="-1"/>
    </aop:config>

    <bean id="retryAdvice"
          class="org.springframework.retry.interceptor.RetryOperationsInterceptor"/>

But again nothing will trigger my @Retryable method. Am I missing something? I'm using Spring 4.3.0 and I tried attaching @Retryable to both my interface (with @Service) and my implementation class along with @Component

Is there a way to dig deeper to see why my @Retryable gets skipped or whether @EnableRetry and the xml equivalent are actually doing something? I don't see any errors in my logs. It's just that the retry does not happen regardless of whether I try to configure spring-retry with xml or using annotations.

@Ghilteras
Copy link
Author

This happens while trying to weave aspects at runtime, should I weave at compile time?

@dsyer
Copy link
Member

dsyer commented Mar 6, 2019

How about creating a simple sample project? It's probably something simple, but hard to diagnose without running actual code.

There's nothing to stop you doing compile time weaving (or load time), but you don't have to do that to use @Retryable.

@Ghilteras
Copy link
Author

Ghilteras commented Mar 21, 2019

Is @Retryable supposed to work without a @Configuration class and just specify the aop config above in my xml?

@dsyer
Copy link
Member

dsyer commented Mar 21, 2019

I don’t remember ever doing it myself, but spring-retry is old enough that I expect I might have. How about that sample project?

@dsyer
Copy link
Member

dsyer commented Jan 20, 2020

I guess at least you need an AnnotationAwareRetryOperationsInterceptor? Someone else was asking about this in #191.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants