Версия 2.3 (текущая версия 2.3.5) добавлена возможность настройки, какие исключения повторяются:
/**
* Set an exception classifications to determine whether the exception should cause a retry
* (until exhaustion) or not. If not, we go straight to the recoverer. By default,
* the following exceptions will not be retried:
* <ul>
* <li>{@link DeserializationException}</li>
* <li>{@link MessageConversionException}</li>
* <li>{@link MethodArgumentResolutionException}</li>
* <li>{@link NoSuchMethodException}</li>
* <li>{@link ClassCastException}</li>
* </ul>
* All others will be retried.
* When calling this method, the defaults will not be applied.
* @param classifications the classifications.
* @param defaultValue whether or not to retry non-matching exceptions.
* @see BinaryExceptionClassifier#BinaryExceptionClassifier(Map, boolean)
*/
public void setClassifications(Map<Class<? extends Throwable>, Boolean> classifications, boolean defaultValue) {
Вот как установлены значения по умолчанию:
Map<Class<? extends Throwable>, Boolean> classified = new HashMap<>();
classified.put(DeserializationException.class, false);
classified.put(MessageConversionException.class, false);
classified.put(MethodArgumentResolutionException.class, false);
classified.put(NoSuchMethodException.class, false);
classified.put(ClassCastException.class, false);
Также Вы можете добавить исключения к значениям по умолчанию:
/**
* Add an exception type to the default list; if and only if an external classifier
* has not been provided. By default, the following exceptions will not be retried:
* <ul>
* <li>{@link DeserializationException}</li>
* <li>{@link MessageConversionException}</li>
* <li>{@link MethodArgumentResolutionException}</li>
* <li>{@link NoSuchMethodException}</li>
* <li>{@link ClassCastException}</li>
* </ul>
* All others will be retried.
* @param exceptionType the exception type.
* @see #removeNotRetryableException(Class)
* @see #setClassifications(Map, boolean)
*/
public void addNotRetryableException(Class<? extends Exception> exceptionType) {
Assert.isTrue(this.classifier instanceof ExtendedBinaryExceptionClassifier,
"Cannot add exception types to a supplied classifier");
((ExtendedBinaryExceptionClassifier) this.classifier).getClassified().put(exceptionType, false);
}