spring-cloud / spring-cloud-gateway

An API Gateway built on Spring Framework and Spring Boot providing routing and more.
http://cloud.spring.io
Apache License 2.0
4.49k stars 3.31k forks source link

How can I load routes from feignClient? #1142

Closed tangdu closed 5 years ago

tangdu commented 5 years ago

where i used Greenwich.RELEASE in my gateway project Can run normally

but now i upgrade Greenwich.SR2 is do not work I found the reason, the getRouteDefinitions method will be called once by default, and feign is not finished. but old version Will not call

` public class FeignRouteDefinitionRepository implements RouteDefinitionRepository { @Autowired private RouterFeignClient client;

@Override
public Flux<RouteDefinition> getRouteDefinitions() {
    return Flux.fromIterable(client.load())
}

@Override public Mono save(Mono route) { return Mono.empty(); }

@Override
public Mono<Void> delete(Mono<String> routeId) {
    return Mono.empty();
}

`

tangdu commented 5 years ago

I am not in the right way.

coligy commented 1 year ago

Hi, I have same problem. Can you tell me how did you solve it? Thanks