Is it possible to somehow dynamically change the value of the uri()
method in spring-cloud-gateway
?
I have this method:
private <T extends RequestData> Function<PredicateSpec, Route.AsyncBuilder> walletRoute(String server, String path, String method, Class<T> inClass) {
return r -> r.path(path)
.and().method(method)
.and().readBody(inClass, requestBody ->
findWalletInstanceWithUserRef(requestBody.getPlayerExternalReference()).equals(server))
.uri("http://" + server).id("th");
}
This method call returns the hostname I want to put inside uri()
:
findWalletInstanceWithUserRef(requestBody.getPlayerExternalReference())
Is it somehow possible to do that?
Thank you