Fixes missing circuit breaker id

Given yaml Properties, CircuitBreaker(`CircuitConfig`) method passes binding test even when given value is `ID` not `CircuitConfig`

- operation method that is annotated with @configuration always pass binding test [findOperation] thereby creating wrong binding from property to method

Introducing Sorting to the operations, it will resolve methods without @configuration to be processed first and @configuration will be matched the last.

Fixes gh-3327
Fixes gh-3397
This commit is contained in:
Jivebread
2024-05-16 22:45:48 +09:00
committed by spencergibb
parent 92159e9213
commit a1cb4eb050

View File

@@ -22,6 +22,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Comparator;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
@@ -244,6 +245,7 @@ public class RouterFunctionHolderFactory {
String operationName, Map<String, Object> operationArgs) {
return operations.getOrDefault(operationName, Collections.emptyList())
.stream()
.sorted(Comparator.comparing(OperationMethod::isConfigurable))
.map(operationMethod -> new NormalizedOperationMethod(operationMethod, operationArgs))
.filter(opeMethod -> matchOperation(opeMethod, operationArgs))
.findFirst();