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)

Assertions using Supplier interface

In this post under JUnit 5, I will show with example, the new version of assert method which takes a Supplier interface implementation as an argument. In previous versions of JUnit, we have seen variety of assert methods, which takes the below arguments.1) The expected value (optional)2) The actual value (required)3) String message when the…… Continue reading Assertions using Supplier interface

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)

Configuring RetryListener (using annotations)

In this post under Spring Retry, I will show with example how to configure RetryListener using annotations. For our example we will need the below “CustomRetryListener2” class CustomRetryListener2 import org.springframework.retry.RetryCallback; import org.springframework.retry.RetryContext; import org.springframework.retry.RetryListener; import org.springframework.stereotype.Component; @Component public class CustomRetryListener2 implements RetryListener { @Override public <T, E extends Throwable> void close(RetryContext arg0, RetryCallback<T, E> arg1,…… Continue reading Configuring RetryListener (using annotations)

Validating html documents against whitelist of html attributes

In one of my previous posts under Jsoup, I showed how to verify html documents against a whitelist of html tags. In this post I will show how to verify html documents against a whitelist of html attributes along with whitelist of html tags. Below is the complete main code for your reference Main class…… Continue reading Validating html documents against whitelist of html attributes

Getting all html elements in a document

In this post under Jsoup, I will show with example how to get a list of all html elements in a document. Below is the main class Main Class 1 import java.io.File; 2 import java.io.IOException; 3 import java.util.Iterator; 4 5 import org.jsoup.Jsoup; 6 import org.jsoup.nodes.Document; 7 import org.jsoup.nodes.Element; 8 import org.jsoup.select.Elements; 9 10 public class…… Continue reading Getting all html elements in a document