In my application I am calling web services. So I thought to implement Spring Retry mechanism to make processing more robust and less prone to failure. This is the first time I am using Spring Retry
I created a Application service class in which I am declaring RetryTemplate and setting RetryPolicy.
But it's throwing below syntax error
"Multiple markers at this line
- Syntax error, insert "Identifier (" to complete MethodHeaderName
- Syntax error on token ".", @ expected after this token
- Syntax error, insert ")" to complete MethodDeclaration"
Even If I use ctrl+space it's not showing setRetryPolicy() method.
Below is my class:
import java.util.Collections;
import org.springframework.retry.policy.SimpleRetryPolicy;
import org.springframework.retry.support.RetryTemplate;
public class ApplicationServiceRetry {
SimpleRetryPolicy policy = new SimpleRetryPolicy(5,Collections
.<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true));
RetryTemplate template = new RetryTemplate();
template.setRetryPolicy(policy); //it's throwing error here
}
I am referring http://docs.spring.io/spring-batch/reference/html/retry.html. Here I am using Spring-retry 1.1.5.RELEASE.