BeforeEach and AfterEach annotations

In this post under JUnit, I will show with example the purpose of BeforeEach and AfterEach annotations. As you know when writing unit test cases, before calling the test method and asserting the output, we should first setup the data on which the test method has to be executed. We can place the code that’s…… Continue reading BeforeEach and AfterEach annotations

Configuring FixedBackOfPolicy (using annotations)

In this post, under Spring Retry I will show with example how to configure FixedBackOfPolicy using annotations. For our example we will use the below service class Service class 1 import java.util.Date; 2 3 import org.springframework.retry.annotation.Backoff; 4 import org.springframework.retry.annotation.Retryable; 5 import org.springframework.stereotype.Service; 6 7 @Service 8 public class Service13 { 9 private int i =…… Continue reading Configuring FixedBackOfPolicy (using annotations)

Configuring maxAttempts for Retry (using annotations)

In this post under Spring Retry, I will explain with example on how to configure maxAttempts for retry operation using annotation. For our example, we will use the below Service class Service Class 1 import org.springframework.retry.annotation.Retryable; 2 import org.springframework.stereotype.Service; 3 4 @Service 5 public class Service12 { 6 private int i = 0; 7 8…… Continue reading Configuring maxAttempts for Retry (using annotations)

Configuring StatisticsListener (using annotations)

In this post under Spring Retry, I will show with example how to configure StatisticsListener using annotations. As explained in previous posts, StatisticsListener class provided by Spring Retry framework collects statistics of a particular retry operations. The statistics information involves1) Abort Count –> How many times the retry was aborted2) Complete Count –> How many…… Continue reading Configuring StatisticsListener (using annotations)

Configuring Recovery Callback (using annotations)

In this post under Spring Retry, I will show with example how to configure a Recovery callback using annotations. Spring Retry retries fail operations for fixed number of times. If the operations fails even after last attempt, we don’t have any other option but to recover from that failure. Spring Retry provides an annotation that…… Continue reading Configuring Recovery Callback (using annotations)

Configuring exceptions to exclude from retry (using annotations)

In the previous post under Spring Retry, I showed with example how to specify the exceptions through annotation, for which a annotated operation has to be retried. In this post, I will show with example how to mention the exceptions through annotation, that when thrown by a annotated operation, Spring retry shouldn’t retry that operation.…… Continue reading Configuring exceptions to exclude from retry (using annotations)

Configuring Exceptions to include for retry (using annotations)

In this post under Spring Retry, I will show with example how to configure the exceptions for which retry has to happen. For the example I will use the below service class. Service8 1 import org.springframework.retry.annotation.Retryable; 2 import org.springframework.stereotype.Service; 3 4 @Service 5 public class Service8 { 6 private int i = 0; 7 8…… Continue reading Configuring Exceptions to include for retry (using annotations)