GH-89: Deprecate templated expressions

Fixes https://github.com/spring-projects/spring-retry/issues/89

* Use literal expressions also for other expression properties
* Revert changes as suggested in the comments
* Updated copyright
* Polishing code style
* Fix JavaDoc in the `RetryTemplateBuilder`
This commit is contained in:
Aldo Sinanaj
2019-02-06 21:23:46 +01:00
committed by Artem Bilan
parent 29adacdeba
commit 2a6cd8b447
4 changed files with 79 additions and 15 deletions

View File

@@ -292,17 +292,17 @@ Version 1.2 introduces the ability to use expressions for certain properties:
```java
@Retryable(exceptionExpression="#{message.contains('this can be retried')}")
@Retryable(exceptionExpression="message.contains('this can be retried')")
public void service1() {
...
}
@Retryable(exceptionExpression="#{message.contains('this can be retried')}")
@Retryable(exceptionExpression="message.contains('this can be retried')")
public void service2() {
...
}
@Retryable(exceptionExpression="#{@exceptionChecker.shouldRetry(#root)}",
@Retryable(exceptionExpression="@exceptionChecker.shouldRetry(#root)",
maxAttemptsExpression = "#{@integerFiveBean}",
backoff = @Backoff(delayExpression = "#{1}", maxDelayExpression = "#{5}", multiplierExpression = "#{1.1}"))
public void service3() {
@@ -310,7 +310,7 @@ public void service3() {
}
```
These use the familier Spring SpEL expression syntax (`#{...}`).
For `exceptionExpression`, templated expressions (`#{...}`) are deprecated in favor of simple expression string (`message.contains('this can be retried')`), since Spring Retry 1.2.5.
Expressions can contain property placeholders such as `#{${max.delay}}` or `#{@exceptionChecker.${retry.method}(#root)}`