Ensure RoutingFuunction can't route to itself

This commit is contained in:
Oleg Zhurakousky
2023-04-25 13:21:25 +02:00
parent eec09cafd5
commit 2d473e7642

View File

@@ -193,6 +193,12 @@ public class RoutingFunction implements Function<Object, Object> {
}
}
if (function.getTarget().equals(this)) {
throw new IllegalStateException("Failed to establish route, and routing to itself is not allowed as it creates a loop. Please provide: "
+ "'spring.cloud.function.definition' as Message header or as application property or "
+ "'spring.cloud.function.routing-expression' as application property.");
}
return function.apply(input);
}