Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -132,10 +133,15 @@ public RetryTopicConfiguration processAnnotation(String[] topics, Class<?> clazz
if (resolvedTimeout != null) {
timeout = resolvedTimeout;
}
List<Class<? extends Throwable>> includes = resolveClasses(annotation.include(), annotation.includeNames(),

String[] resolvedIncludeNames = resolveToStringArray(annotation.includeNames());
List<Class<? extends Throwable>> includes = resolveClasses(annotation.include(), resolvedIncludeNames,
"include");
List<Class<? extends Throwable>> excludes = resolveClasses(annotation.exclude(), annotation.excludeNames(),

String[] resolvedExcludeNames = resolveToStringArray(annotation.excludeNames());
List<Class<? extends Throwable>> excludes = resolveClasses(annotation.exclude(), resolvedExcludeNames,
"exclude");

boolean traverse = false;
if (StringUtils.hasText(annotation.traversingCauses())) {
Boolean traverseResolved = resolveExpressionAsBoolean(annotation.traversingCauses(), "traversingCauses");
Expand Down Expand Up @@ -423,4 +429,25 @@ private String resolve(String value) {
return value;
}

private String[] resolveToStringArray(String[] values) {
List<String> result = new ArrayList<>();
for (String value : values) {
Object resolved = resolveExpression(value);
if (resolved instanceof String[] strings) {
Collections.addAll(result, strings);
}
else if (resolved instanceof Collection<?> coll) {
for (Object item : coll) {
result.add(item.toString());
}
}
else if (resolved instanceof String str) {
result.addAll(Arrays.asList(StringUtils.commaDelimitedListToStringArray(str)));
}
else if (resolved != null) {
result.add(resolved.toString());
}
}
return result.toArray(new String[0]);
}
}