You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having a similar issue with @Recover that is similar to the linked issue #32. In order to make it work it has to be on the interface and not the implementing class.
I used the following class and test
public interface TestService {
void doStuff();
void recover();
}
@Named
public class TestServiceImpl implements TestService {
@Retryable
public void doStuff() {
}
@Recover
public void recover() {
System.out.println("recover");
}
}
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public static class RetryTests extends SpringRetryTest {
@Inject
private TestService testService;
@Test
public void testRecover() {
testService.doStuff();
verify(testService, times(3)).doStuff();
}
@After
public void validate() {
validateMockitoUsage();
}
@Configuration
@EnableRetry
public static class SpringConfig {
@Bean
public TestService testService() {
TestService testService = mock(TestServiceImpl.class);
Mockito.doThrow(new RuntimeException())
.doThrow(new RuntimeException())
.doThrow(new RuntimeException())
.when(testService).doStuff();
return testService;
}
}
}
But if you move the @Recover to the interface it works.
The text was updated successfully, but these errors were encountered:
You probably need @EnableRetry(proxyTargetClass=true) there to make the annotations in the implementation class visible in the proxy. I don't think there's a better way to solve this problem.
I'm having a similar issue with
@Recover
that is similar to the linked issue #32. In order to make it work it has to be on the interface and not the implementing class.I used the following class and test
But if you move the
@Recover
to the interface it works.The text was updated successfully, but these errors were encountered: