|
19 | 19 | import java.lang.reflect.Method;
|
20 | 20 | import java.util.ArrayList;
|
21 | 21 | import java.util.Arrays;
|
| 22 | +import java.util.Collection; |
22 | 23 | import java.util.Collections;
|
23 | 24 | import java.util.List;
|
24 | 25 | import java.util.Map;
|
@@ -132,10 +133,15 @@ public RetryTopicConfiguration processAnnotation(String[] topics, Class<?> clazz
|
132 | 133 | if (resolvedTimeout != null) {
|
133 | 134 | timeout = resolvedTimeout;
|
134 | 135 | }
|
135 |
| - List<Class<? extends Throwable>> includes = resolveClasses(annotation.include(), annotation.includeNames(), |
| 136 | + |
| 137 | + String[] resolvedIncludeNames = resolveToStringArray(annotation.includeNames()); |
| 138 | + List<Class<? extends Throwable>> includes = resolveClasses(annotation.include(), resolvedIncludeNames, |
136 | 139 | "include");
|
137 |
| - List<Class<? extends Throwable>> excludes = resolveClasses(annotation.exclude(), annotation.excludeNames(), |
| 140 | + |
| 141 | + String[] resolvedExcludeNames = resolveToStringArray(annotation.excludeNames()); |
| 142 | + List<Class<? extends Throwable>> excludes = resolveClasses(annotation.exclude(), resolvedExcludeNames, |
138 | 143 | "exclude");
|
| 144 | + |
139 | 145 | boolean traverse = false;
|
140 | 146 | if (StringUtils.hasText(annotation.traversingCauses())) {
|
141 | 147 | Boolean traverseResolved = resolveExpressionAsBoolean(annotation.traversingCauses(), "traversingCauses");
|
@@ -423,4 +429,25 @@ private String resolve(String value) {
|
423 | 429 | return value;
|
424 | 430 | }
|
425 | 431 |
|
| 432 | + private String[] resolveToStringArray(String[] values) { |
| 433 | + List<String> result = new ArrayList<>(); |
| 434 | + for (String value : values) { |
| 435 | + Object resolved = resolveExpression(value); |
| 436 | + if (resolved instanceof String[] strings) { |
| 437 | + Collections.addAll(result, strings); |
| 438 | + } |
| 439 | + else if (resolved instanceof Collection<?> coll) { |
| 440 | + for (Object item : coll) { |
| 441 | + result.add(item.toString()); |
| 442 | + } |
| 443 | + } |
| 444 | + else if (resolved instanceof String str) { |
| 445 | + result.addAll(Arrays.asList(StringUtils.commaDelimitedListToStringArray(str))); |
| 446 | + } |
| 447 | + else if (resolved != null) { |
| 448 | + result.add(resolved.toString()); |
| 449 | + } |
| 450 | + } |
| 451 | + return result.toArray(new String[0]); |
| 452 | + } |
426 | 453 | }
|
0 commit comments